Closed
Description
I am currently working on a project and encountered a trait mismatch error in the x86_64
crate while building. Since I don't have time to rewrite the library, I decided to test the crate separately by cloning it and attempting to build it.
Steps I followed:
- Cloned the repository and tried building it on a fresh setup.
- Encountered the same error related to a trait mismatch in the
steps_between
method in thex86_64
crate.
The error message I am receiving is as follows:
error[E0053]: method `steps_between` has an incompatible type for trait
--> /home/masterplan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x86_64-0.15.1/src/addr.rs:362:51
|
362 | fn steps_between(start: &Self, end: &Self) -> Option<usize> {
| ^^^^^^^^^^^^^ expected `(usize, Option<usize>)`, found `Option<usize>`
|
= note: expected signature `fn(&addr::VirtAddr, &addr::VirtAddr) -> (usize, Option<usize>)`
found signature `fn(&addr::VirtAddr, &addr::VirtAddr) -> Option<usize>`
help: change the output type to match the trait
|
362 | fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
| ~~~~~~~~~~~~~~~~~~~~~~
Steps to reproduce:
-
Clone the repository and enter the directory:
git clone https://github.com/rust-osdev/x86_64 cd x86-64
-
Set the Rust toolchain to nightly (already set in my environment):
rustup default nightly
-
Attempt to build the project with the following command:
cargo build
Result:
The build fails with the error related to the trait mismatch, as shown in the terminal output above.
Screenshots/Terminal Output:
Metadata
Metadata
Assignees
Labels
No labels
Activity
tsatke commentedon Nov 24, 2024
Caused by rust-lang/rust/pull/130867
For now, I'd suggest you use a nightly version before that PR was merged until a version containing the fix is released.
Step
has changed incore
in nightly rust 1.85 #514check_segment_align
asterinas/asterinas#1664