Comments (8)
from uniffi-rs.
I assume you mean 0.25, etc. (there's no v2.x
yet)
from uniffi-rs.
I cannot reproduce this locally. Code inline below.
Tested with 0.25, 0.26 and 0.27. All compiles, targetting the host architecture.
The proc macros correctly use ::core::*
. Given that's ... the core library it should exist.
If you can providing the failing code in a git repository would help us debug this further.
lib.rs
:
use std::time::SystemTime;
#[allow(non_camel_case_types)]
pub enum ExampleEnum {
v1, v2
}
pub struct Glucose {
raw: f32,
timestamp: SystemTime,
local_timestamp: SystemTime,
}
pub fn hello_world() -> String {
String::from("hello world")
}
pub struct TodoList;
impl TodoList {
fn new() -> Self {
TodoList {
}
}
}
uniffi::include_scaffolding!("uniffi-bug-test");
UDL:
namespace uniffi_bug_test {
/// Hello Rust
string hello_world();
};
/// Example Enum
enum ExampleEnum {
"v1",
"v2",
};
/// Glucose
dictionary Glucose {
f32 raw;
timestamp timestamp;
timestamp local_timestamp;
};
/// TodoList
interface TodoList {
constructor();
};
from uniffi-rs.
@badboy thanks for looking into it, I'll try building a repo that reproduces the issue.
I failed to mention some information:
- It runs fine on 0.25.x
- here is what our Cargo.toml looks like, could it be possible us having a local "core" crate causes some namespace clashing?
...
[dependencies]
uniffi = { version = "0.27.2", features = [ "cli" ] }
shared = { path = "../rust/shared" }
core = { path = "../rust/core" }
[build-dependencies]
uniffi = { version = "0.27.2", features = [ "build" ] }
...
from uniffi-rs.
@badboy Indeed, renaming our local core lib to anything else works...
from uniffi-rs.
There are some places we use core::
where using ::core::
would probably solve this - eg, here
from uniffi-rs.
@mhammond That was my thought as well, I've unblocked us by renaming our current library, but I bet lots of repos would have a "core" package internal to them, would be nice to prioritize this issue
from uniffi-rs.
There are some places we use
core::
where using::core::
would probably solve this - eg, here
Ah, somehow that is the one instance I overlooked. Yes, changing that to ::core
should likely fix this issue.
@mhammond That was my thought as well, I've unblocked us by renaming our current library, but I bet lots of repos would have a "core" package internal to them, would be nice to prioritize this issue
I kinda doubt that many people name their crate core
. Probably a lot of other crates would use core::
and thus naming an internal crate core
has high potential of more breakage. Nonetheless we should of course fix uniffi here.
from uniffi-rs.
Related Issues (20)
- Support for projects not using `cargo` HOT 1
- Workspace broken | UniFFI generates invalid Swift & Python bindings HOT 9
- Design and agree on a 1.0 FFI HOT 4
- Use C structs/tagged unions for Records/Enums HOT 2
- Store return values in RustCallStatus
- Using proc-macros for constructor requires Arc<Self> HOT 4
- Accessing Vec<u8> in swift HOT 2
- Use a single buffer for all data
- Better Buffer packing
- Use the `FfiValue` type for all arguments HOT 1
- `HandleAlloc::clone_handle` and `consume_handle` should be marked unsafe HOT 3
- Rust pointers can have both even and odd addresses HOT 4
- `RustCallStatus::error_buf` should be `ManuallyDrop`, not `MaybeUninit`?
- Add implemented traits to generated code, or add extension? HOT 2
- [Swift] Would it be possible to use checked exceptions? HOT 6
- Only invoke cargo metadata for desired targets HOT 7
- Add a conversion pass before rendering the bindings templates HOT 3
- How to get Rust panic backtrace?
- Swift classes are not generated properly with their Protocol as Generic Type HOT 2
- Interface/Protocol use in foreign generated code HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uniffi-rs.