LearningOS / rCore-Tutorial-Guide-2024S

GNU General Public License v3.0
4 stars 3 forks source link

rCore-Tutorial-Guide-2024S/chapter1/4mini-rt-baremetal #25

Open utterances-bot opened 3 months ago

utterances-bot commented 3 months ago

构建裸机执行环境 - rCore-Tutorial-Guide-2024S 文档

https://learningos.cn/rCore-Tutorial-Guide-2024S/chapter1/4mini-rt-baremetal.html

luvroc commented 3 months ago
error[E0599]: no method named `unwrap` found for struct `PanicMessage` in the current scope
  --> src/lang_items.rs:11:28
   |
11 |             info.message().unwrap()
   |                            ^^^^^^ method not found in `PanicMessage<'_>`

我在添加裸机打印相关函数修改lang_items时遇到此报错,这是在1.82.0nightly(612a33f20 2024-07-29)的报错,而在更早的版本, 比如rustc 1.79.0 (129f3b996 2024-06-10)1.80.0nightly(2024-05-25) 报错如下:

error[E0658]: use of unstable library feature 'panic_info_message'
  --> src/lang_items.rs:11:18
   |
11 |             info.message().unwrap()
   |                  ^^^^^^^
   |
   = note: see issue #66745 <https://github.com/rust-lang/rust/issues/66745> for more information
   = help: add `#![feature(panic_info_message)]` to the crate attributes to enable
   = note: this compiler was built on 2024-05-24; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'panic_info_message'
  --> src/lang_items.rs:14:48
   |
14 |         println!("[kernel] Panicked: {}", info.message().unwrap())
   |                                                ^^^^^^^
   |
   = note: see issue #66745 <https://github.com/rust-lang/rust/issues/66745> for more information
   = help: add `#![feature(panic_info_message)]` to the crate attributes to enable
   = note: this compiler was built on 2024-05-24; consider upgrading it if it is out of date

解决方案:在1.82.0nightly(612a33f20 2024-07-29)下,将这两行后面的·wrap()删去