`const_fn` weirdness on v0.9.0
reinvantveer opened this issue · 5 comments
Hi, thank you for sharing all this awesomeness. It's truly amazing.
Since lock_api dropped the const_fn
attribute, in v0.4.4 commit Amanieu/parking_lot@aea1350 I'm running into compile trouble using the use_spin_nightly
feature. I'm using a custom-built 1.52.0-dev nightly Rust/Cargo and LLVM toolchain with Motorola 68000 family support, which I play around with to program for the Sega Megadrive. It's a blast.
dependency:
linked_list_allocator = { version = "0.9.0", default-features = false, features = ["use_spin_nightly"] }
I get:
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lock_api-0.4.4/src/rwlock.rs:348:6
|
348 | impl<R: RawRwLock, T> RwLock<R, T> {
| ^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn)]` to the crate attributes to enable
I'm fairly new to this. I haven't done any systems programming before, and some elevator-music equivalent of Rust programming. Any idea on how to get around this? Thanks in advance for any pointers!
This sounds like you need to update your Rust nightly version. If that's too difficult for you, you could try to add an lock_api = "=0.4.3
dependency to your crate as a workaround, then cargo should use that version for linked_list_allocator
as well.
Thanks for the response! That resolves in a different compile error:
error[E0432]: unresolved import `core::sync::atomic::AtomicUsize`
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lock_api-0.4.3/src/remutex.rs:19:20
|
19 | sync::atomic::{AtomicUsize, Ordering},
| ^^^^^^^^^^^ no `AtomicUsize` in `sync::atomic`
Any suggestions on this?
I did find this: Amanieu/parking_lot#277 but I'm not sure it applies here. I can import core::sync::atomic::AtomicUsize
without problem in my lib.rs
. Can't think of a reason why https://github.com/Amanieu/parking_lot/blob/lock_api-0.4.3/lock_api/src/remutex.rs#L19 would pose an issue.
Are you sure that you can import it in your lib.rs for the same target?
Ah. Double-checking and I see it doesn't, my bad. It just was not the first AtomicUsize for the compiler to stumble over. I think with pinning lock_api = "=0.4.3"
in my own cargo toml is enough information to go on for now. Thanks!