The `alloc_ref` feature is broken on latest nightly
phil-opp opened this issue ยท 13 comments
Seems like the signature of the AllocRef
trait was changed again in the Rust standard library. To fix the feature, we need to update our code to the new trait signature.
Got the issue as well, might be related. Everything nightly and latest.
error[E0463]: can't find crate for `alloc`
--> /Users/ghaiklor/.cargo/registry/src/github.com-1ecc6299db9ec823/linked_list_allocator-0.8.6/src/lib.rs:15:1
|
15 | extern crate alloc;
| ^^^^^^^^^^^^^^^^^^^ can't find crate
@ghaiklor This looks more like you forget to cross compile the alloc
crate. If you're using the build-std
feature of cargo, make sure to pass alloc
to it in addition to core
.
@phil-opp yeap, it did the trick, thanks! Started getting errors about duplicate identifiers now:
error[E0252]: the name `PhysFrame` is defined multiple times
--> /Users/ghaiklor/.cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.12.2/src/structures/paging/mod.rs:7:9
|
5 | pub use self::frame::PhysFrame;
| ---------------------- previous import of the type `PhysFrame` here
6 | #[allow(deprecated)]
7 | pub use self::frame_alloc::PhysFrame;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `PhysFrame` reimported here
|
= note: `PhysFrame` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
|
5 | pub use self::frame::PhysFrame as OtherPhysFrame;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0255]: the name `PhysFrame` is defined multiple times
--> /Users/ghaiklor/.cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.12.2/src/structures/paging/frame_alloc.rs:28:1
|
3 | use crate::structures::paging::{PageSize, PhysFrame, Size4KiB};
| --------- previous import of the type `PhysFrame` here
...
28 | pub struct PhysFrame<S: PageSize = Size4KiB>(PhysFrame<S>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `PhysFrame` redefined here
|
= note: `PhysFrame` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
|
3 | use crate::structures::paging::{PageSize, PhysFrame as OtherPhysFrame, Size4KiB};
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compiling spinning_top v0.1.1
Compiling linked_list_allocator v0.8.6
error[E0392]: parameter `S` is never used
--> /Users/ghaiklor/.cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.12.2/src/structures/paging/frame_alloc.rs:28:22
|
28 | pub struct PhysFrame<S: PageSize = Size4KiB>(PhysFrame<S>);
| ^ unused parameter
|
= help: consider removing `S`, referring to it in a field, or using a marker such as `PhantomData`
error: aborting due to 3 previous errors
Perhaps you accidentally modified the crate source locally? It looks like you replaced some instances of UnusedPhysFrame
with PhysFrame
.
Hm, I don't think so. cargo clean && cargo build
didn't help.
If you accidentally edited the source files in your Cargo home dir (see https://doc.rust-lang.org/cargo/guide/cargo-home.html), cargo clean
is not enough. Instead, you probably have to manually delete the registry
folder there.
(I'm not 100% sure if that's really the issue, but I can't think of anything else that could cause these errors. Accidental modification of these sources could e.g. happen when you use VSCode and rust-analyzer, and ctrl-click on a type defined in x86_64
. Then rust-analyzer will take you directly to the cached crate source in your Cargo home directory.)
I thought cargo clean
cleans everything, didn't know about it. I'll try later and report, thanks!
It helped, seeing errors in my code only now! Something with updates in types, I'll try to figure it out. For others, who see the same issue, I did rm -rf ~/.cargo/registry
, updated rustup and rust and it fixed the issue from above.
Ah, MapToError
changed, now it requires a PageSize
:
pub fn init_heap(
mapper: &mut impl Mapper<Size4KiB>,
frame_allocator: &mut impl FrameAllocator<Size4KiB>,
) -> Result<(), MapToError> {
Great to hear that!
Hello there,
After a rustp update
, cargo clean
, rm ~/.cargo/registry
I get an error at build. But I am not sure however it is the same issue.
Compiling linked_list_allocator v0.8.6
error[E0658]: function pointers cannot appear in constant functions
--> /home/mik/.cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.11.8/src/structures/idt.rs:378:31
|
378 | divide_error: Entry::missing(),
| ^^^^^^^^^^^^^^^^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error[E0658]: mutable references are not allowed in constant functions
--> /home/mik/.cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.11.8/src/structures/idt.rs:378:31
|
378 | divide_error: Entry::missing(),
| ^^^^^^^^^^^^^^^^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0658]: function pointers cannot appear in constant functions
--> /home/mik/.cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.11.8/src/structures/idt.rs:379:24
|
379 | debug: Entry::missing(),
| ^^^^^^^^^^^^^^^^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
etc...
error[E0658]: mutable references are not allowed in constant functions
--> /home/mik/.cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.11.8/src/structures/idt.rs:402:30
|
402 | interrupts: [Entry::missing(); 256 - 32],
| ^^^^^^^^^^^^^^^^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 54 previous errors
For more information about this error, try `rustc --explain E0658`.
error: could not compile `x86_64`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
I am a beginner with Rust And looking for something to do. If I can help to fix this issue I will do it with pleasure. Just let me know how I can start. Is there some test to run ? I use this library on my https://github.com/phil-opp/blog_os version.
@MikHulk This issue is about the x86_64
crate, not about the linked_list_allocator
. There was a breaking change in a recent nightly that is the cause of this error. Try updating your dependency on the x86_64
to version 0.12.2
in your Cargo.toml.
oh yes indeed...
sorry for that