I'm trying to use this crate in an OS kernel project to allow dynamically loading kernel modules and making function calls across module boundaries which requires a stable ABI, however stabby fails to even build when default-features = false is used. I tested it on a dummy crate using a simple point struct and it works with default-features enabled but not with them set to false.
Is there something I need to do to make stabby work with no-std?
The error messages I get are the following:
Compiling proc-macro2 v1.0.86
Compiling unicode-ident v1.0.13
Compiling libc v0.2.158
Compiling cfg-if v1.0.0
Compiling byteorder v1.5.0
Compiling equivalent v1.0.1
Compiling hashbrown v0.14.5
Compiling toml_datetime v0.6.8
Compiling winnow v0.6.18
Compiling syn v1.0.109
Compiling stabby-macros v36.1.1
Compiling rustversion v1.0.17
Compiling stabby-abi v36.1.1
Compiling stabby v36.1.1
Compiling sha2-const-stable v0.1.0
Compiling quote v1.0.37
Compiling indexmap v2.5.0
Compiling getrandom v0.2.15
Compiling syn v2.0.77
Compiling rand_core v0.6.4
Compiling toml_edit v0.22.21
Compiling zerocopy-derive v0.7.35
Compiling zerocopy v0.7.35
Compiling proc-macro-crate v3.2.0
Compiling ppv-lite86 v0.2.20
Compiling rand_chacha v0.3.1
Compiling rand v0.8.5
error[E0277]: the trait bound `Infallible: Default` is not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/alloc/collections/arc_btree.rs:13:5
|
13 | DefaultAllocator: core::default::Default + IAlloc;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `Infallible`
|
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/lib.rs:30:1
|
30 + #![feature(trivial_bounds)]
|
error[E0277]: the trait bound `Infallible: Default` is not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/alloc/collections/arc_btree.rs:17:5
|
17 | DefaultAllocator: core::default::Default + IAlloc,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `Infallible`
|
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/lib.rs:30:1
|
30 + #![feature(trivial_bounds)]
|
error[E0277]: the trait bound `Infallible: Default` is not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/alloc/collections/arc_btree.rs:26:5
|
26 | DefaultAllocator: core::default::Default + IAlloc,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `Infallible`
|
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/lib.rs:30:1
|
30 + #![feature(trivial_bounds)]
|
error[E0277]: the trait bound `Infallible: Default` is not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/alloc/collections/arc_btree.rs:252:5
|
252 | DefaultAllocator: core::default::Default,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `Infallible`
|
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/lib.rs:30:1
|
30 + #![feature(trivial_bounds)]
|
error[E0277]: the trait bound `Infallible: istable::IStable` is not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/alloc/single_or_vec.rs:20:52
|
20 | pub struct SingleOrVec<T: IStable, Alloc: IAlloc + IStable = DefaultAllocator>
| ^^^^^^^ the trait `istable::IStable` is not implemented for `Infallible`
|
= help: the following other types implement trait `istable::IStable`:
&T
&mut T
()
*const T
*mut T
Align1024
Align128
Align16384
and 405 others
error[E0599]: no variant or associated item named `new` found for enum `Infallible` in the current scope
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/alloc/collections/arc_btree.rs:200:40
|
200 | Self::new_in(DefaultAllocator::new())
| ^^^ variant or associated item not found in `Infallible`
|
help: there is a method `ne` with a similar name, but with different arguments
--> /home/mpatel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:261:5
|
261 | fn ne(&self, other: &Rhs) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0599]: the method `with_waker` exists for struct `StableWaker<'_>`, but its trait bounds were not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:191:15
|
120 | #[crate::stabby]
| ---------------- method `with_waker` not found for this struct
...
191 | waker.with_waker(|waker| {
| ------^^^^^^^^^^ method cannot be called on `StableWaker<'_>` due to unsatisfied trait bounds
|
::: /home/mpatel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:904:1
|
904 | pub enum Infallible {}
| ------------------- doesn't satisfy `Infallible: Default`
|
note: trait bound `Infallible: Default` was not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:127:30
|
127 | impl<'a, Alloc: IAlloc + Default> StableWaker<'a, Alloc> {
| ^^^^^^^ ----------------------
| |
| unsatisfied trait bound introduced here
error[E0277]: the trait bound `Infallible: Default` is not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:214:94
|
214 | (this.vtable().head.poll.as_ref_unchecked())(this.ptr_mut().as_mut(), cx.waker().into())
| ^^^^ the trait `Default` is not implemented for `Infallible`, which is required by `&core::task::Waker: Into<_>`
|
note: required for `StableWaker<'_>` to implement `From<&core::task::Waker>`
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:165:39
|
165 | impl<'a, Alloc: IAlloc + Default> From<&'a Waker> for StableWaker<'a, Alloc> {
| ------- ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
= note: required for `&core::task::Waker` to implement `Into<StableWaker<'_>>`
error[E0277]: the trait bound `Infallible: Default` is not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:237:28
|
237 | cx.waker().into(),
| ^^^^ the trait `Default` is not implemented for `Infallible`, which is required by `&core::task::Waker: Into<_>`
|
note: required for `StableWaker<'_>` to implement `From<&core::task::Waker>`
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:165:39
|
165 | impl<'a, Alloc: IAlloc + Default> From<&'a Waker> for StableWaker<'a, Alloc> {
| ------- ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
= note: required for `&core::task::Waker` to implement `Into<StableWaker<'_>>`
error[E0277]: the trait bound `Infallible: Default` is not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:261:28
|
261 | cx.waker().into(),
| ^^^^ the trait `Default` is not implemented for `Infallible`, which is required by `&core::task::Waker: Into<_>`
|
note: required for `StableWaker<'_>` to implement `From<&core::task::Waker>`
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:165:39
|
165 | impl<'a, Alloc: IAlloc + Default> From<&'a Waker> for StableWaker<'a, Alloc> {
| ------- ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
= note: required for `&core::task::Waker` to implement `Into<StableWaker<'_>>`
error[E0277]: the trait bound `Infallible: Default` is not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:287:28
|
287 | cx.waker().into(),
| ^^^^ the trait `Default` is not implemented for `Infallible`, which is required by `&core::task::Waker: Into<_>`
|
note: required for `StableWaker<'_>` to implement `From<&core::task::Waker>`
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:165:39
|
165 | impl<'a, Alloc: IAlloc + Default> From<&'a Waker> for StableWaker<'a, Alloc> {
| ------- ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
= note: required for `&core::task::Waker` to implement `Into<StableWaker<'_>>`
error[E0277]: the trait bound `Infallible: Default` is not satisfied
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:313:28
|
313 | cx.waker().into(),
| ^^^^ the trait `Default` is not implemented for `Infallible`, which is required by `&core::task::Waker: Into<_>`
|
note: required for `StableWaker<'_>` to implement `From<&core::task::Waker>`
--> /home/mpatel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stabby-abi-36.1.1/src/future.rs:165:39
|
165 | impl<'a, Alloc: IAlloc + Default> From<&'a Waker> for StableWaker<'a, Alloc> {
| ------- ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
= note: required for `&core::task::Waker` to implement `Into<StableWaker<'_>>`
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `stabby-abi` (lib) due to 12 previous errors
I'm trying to use this crate in an OS kernel project to allow dynamically loading kernel modules and making function calls across module boundaries which requires a stable ABI, however stabby fails to even build when default-features = false is used. I tested it on a dummy crate using a simple point struct and it works with default-features enabled but not with them set to false.
Is there something I need to do to make stabby work with no-std?
The error messages I get are the following: