phil-opp / blog_os

Writing an OS in Rust
http://os.phil-opp.com
Apache License 2.0
14.27k stars 1.01k forks source link

x86_64 0.13.2 seems to not work out-of-the-box anymore. 0.14.1 works well #982

Closed szborows closed 3 years ago

szborows commented 3 years ago

hi,

when running cargo test in post-05 (right after introducing x86_64) compilation fails with following errors. I know @phil-opp you are involved in the other thread, so just wanna ask - shouldn't the blog post be updated?

https://github.com/rust-osdev/x86_64/pull/250

    Updating crates.io index
  Downloaded x86_64 v0.13.6
  Downloaded 1 crate (60.7 KB) in 0.70s
   Compiling bitflags v1.2.1
   Compiling x86_64 v0.13.6
   Compiling bit_field v0.9.0
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
  --> /home/szborows/.cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.13.6/src/structures/paging/frame.rs:18:6
   |
18 | impl<S: PageSize> PhysFrame<S> {
   |      ^
   |
   = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
   = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable

error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
  --> /home/szborows/.cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.13.6/src/structures/paging/page.rs:62:6
   |
62 | impl<S: PageSize> Page<S> {
   |      ^
   |
   = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
   = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable

error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
   --> /home/szborows/.cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.13.6/src/structures/paging/page.rs:150:6
    |
150 | impl<S: NotGiantPageSize> Page<S> {
    |      ^
    |
    = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
    = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0658`.
error: could not compile `x86_64`
ghost commented 3 years ago

x86_64 version 0.13.6 broke only recently with the release of another version of rustup nightly. I only noticed the problem myself on April 30 of this year, so it's pretty fresh. By rebuilding the project with older rust everything should work. Also take a look at the page that the compiler gives you. https://github.com/rust-lang/rust/issues/57563

phil-opp commented 3 years ago

Thanks for reporting! As @JakubGawron23 noted, this is caused by some breaking changes on the Rust nightly channel. I try my best to update the blog for this soon!

szborows commented 3 years ago

I erroneously reported it as problem in post-05. It actually refers to post-04. Version 0.14.1 helps, but then when you move to post-05 you'll face following error. As for now, as @JakubGawron23 wrote, the best solution is to use older nightly build of Rust.

error[E0308]: mismatched types
 --> src/interrupts.rs:6:35
  |
6 |     idt.breakpoint.set_handler_fn(breakpoint_handler);
  |                                   ^^^^^^^^^^^^^^^^^^ expected struct `InterruptStackFrame`, found `&mut InterruptStackFrame`
  |
  = note: expected fn pointer `extern "x86-interrupt" fn(InterruptStackFrame)`
                found fn item `extern "x86-interrupt" for<'r> fn(&'r mut InterruptStackFrame) {breakpoint_handler}`
phil-opp commented 3 years ago

This should be fixed with https://github.com/phil-opp/blog_os/pull/990. Please let me know if you still have problems!