From ab1d931cb7228722976319a5b4a948d0b54eecc8 Mon Sep 17 00:00:00 2001 From: Zhang Junyang Date: Thu, 20 Jun 2024 15:55:36 +0000 Subject: [PATCH] Adjust for Rust unstable feature's stability change --- .../aster-frame/src/bus/pci/device_info.rs | 27 ++++++++++--------- framework/aster-frame/src/lib.rs | 1 - framework/aster-frame/src/panicking.rs | 2 +- .../libs/linux-bzimage/boot-params/src/lib.rs | 1 - .../linux-bzimage/setup/.cargo/config.toml | 2 +- kernel/aster-nix/src/lib.rs | 2 +- kernel/comps/block/src/lib.rs | 1 + osdk/src/commands/build/bin.rs | 2 +- osdk/src/commands/build/mod.rs | 2 +- 9 files changed, 21 insertions(+), 19 deletions(-) diff --git a/framework/aster-frame/src/bus/pci/device_info.rs b/framework/aster-frame/src/bus/pci/device_info.rs index 0f4db9a9f..05cd91034 100644 --- a/framework/aster-frame/src/bus/pci/device_info.rs +++ b/framework/aster-frame/src/bus/pci/device_info.rs @@ -69,20 +69,23 @@ impl PciDeviceLocation { /// Returns an iterator that enumerates all possible PCI device locations. pub fn all() -> impl Iterator { - iter::from_coroutine(|| { - for bus in Self::MIN_BUS..=Self::MAX_BUS { - for device in Self::MIN_DEVICE..=Self::MAX_DEVICE { - for function in Self::MIN_FUNCTION..=Self::MAX_FUNCTION { - let loc = PciDeviceLocation { - bus, - device, - function, - }; - yield loc; + iter::from_coroutine( + #[coroutine] + || { + for bus in Self::MIN_BUS..=Self::MAX_BUS { + for device in Self::MIN_DEVICE..=Self::MAX_DEVICE { + for function in Self::MIN_FUNCTION..=Self::MAX_FUNCTION { + let loc = PciDeviceLocation { + bus, + device, + function, + }; + yield loc; + } } } - } - }) + }, + ) } /// The page table of all devices is the same. So we can use any device ID. diff --git a/framework/aster-frame/src/lib.rs b/framework/aster-frame/src/lib.rs index a36450ee8..7af1fcc56 100644 --- a/framework/aster-frame/src/lib.rs +++ b/framework/aster-frame/src/lib.rs @@ -15,7 +15,6 @@ #![feature(panic_info_message)] #![feature(ptr_sub_ptr)] #![feature(strict_provenance)] -#![feature(pointer_is_aligned)] // The `generic_const_exprs` feature is incomplete however required for the page table // const generic implementation. We are using this feature in a conservative manner. #![allow(incomplete_features)] diff --git a/framework/aster-frame/src/panicking.rs b/framework/aster-frame/src/panicking.rs index 22ab8189f..dbd799ffa 100644 --- a/framework/aster-frame/src/panicking.rs +++ b/framework/aster-frame/src/panicking.rs @@ -30,7 +30,7 @@ use unwinding::{ #[export_name = "__aster_panic_handler"] pub fn panic_handler(info: &core::panic::PanicInfo) -> ! { let throw_info = ktest::PanicInfo { - message: info.message().unwrap().to_string(), + message: info.message().to_string(), file: info.location().unwrap().file().to_string(), line: info.location().unwrap().line() as usize, col: info.location().unwrap().column() as usize, diff --git a/framework/libs/linux-bzimage/boot-params/src/lib.rs b/framework/libs/linux-bzimage/boot-params/src/lib.rs index fcfc79fed..e6e6e807f 100644 --- a/framework/libs/linux-bzimage/boot-params/src/lib.rs +++ b/framework/libs/linux-bzimage/boot-params/src/lib.rs @@ -8,7 +8,6 @@ //! currently not needed by Asterinas. //! -#![feature(offset_of)] #![cfg_attr(not(test), no_std)] /// Magic stored in the boot protocol header. diff --git a/framework/libs/linux-bzimage/setup/.cargo/config.toml b/framework/libs/linux-bzimage/setup/.cargo/config.toml index c99a31b3e..e02744b99 100644 --- a/framework/libs/linux-bzimage/setup/.cargo/config.toml +++ b/framework/libs/linux-bzimage/setup/.cargo/config.toml @@ -5,5 +5,5 @@ rustflags = [ "-Ctarget-feature=+crt-static", "-Zplt=yes", "-Zrelax-elf-relocations=yes", - "-Zrelro-level=full", + "-Crelro-level=full", ] diff --git a/kernel/aster-nix/src/lib.rs b/kernel/aster-nix/src/lib.rs index 073b035e8..c4328d58a 100644 --- a/kernel/aster-nix/src/lib.rs +++ b/kernel/aster-nix/src/lib.rs @@ -7,7 +7,6 @@ #![feature(btree_cursors)] #![feature(btree_extract_if)] #![feature(const_option)] -#![feature(exclusive_range_pattern)] #![feature(extend_one)] #![feature(fn_traits)] #![feature(format_args_nl)] @@ -21,6 +20,7 @@ #![feature(specialization)] #![feature(step_trait)] #![feature(trait_alias)] +#![feature(trait_upcasting)] #![register_tool(component_access_control)] use aster_frame::{ diff --git a/kernel/comps/block/src/lib.rs b/kernel/comps/block/src/lib.rs index 78d4a6b73..161c233f3 100644 --- a/kernel/comps/block/src/lib.rs +++ b/kernel/comps/block/src/lib.rs @@ -30,6 +30,7 @@ #![deny(unsafe_code)] #![feature(fn_traits)] #![feature(step_trait)] +#![feature(trait_upcasting)] #![allow(dead_code)] extern crate alloc; diff --git a/osdk/src/commands/build/bin.rs b/osdk/src/commands/build/bin.rs index cb7713935..d960d8067 100644 --- a/osdk/src/commands/build/bin.rs +++ b/osdk/src/commands/build/bin.rs @@ -153,7 +153,7 @@ fn install_setup_with_arch( let target_dir = std::fs::canonicalize(target_dir).unwrap(); let mut cmd = Command::new("cargo"); - cmd.env("RUSTFLAGS", "-Ccode-model=kernel -Crelocation-model=pie -Ctarget-feature=+crt-static -Zplt=yes -Zrelax-elf-relocations=yes -Zrelro-level=full"); + cmd.env("RUSTFLAGS", "-Ccode-model=kernel -Crelocation-model=pie -Ctarget-feature=+crt-static -Zplt=yes -Zrelax-elf-relocations=yes -Crelro-level=full"); cmd.arg("install").arg("linux-bzimage-setup"); cmd.arg("--force"); cmd.arg("--root").arg(install_dir.as_ref()); diff --git a/osdk/src/commands/build/mod.rs b/osdk/src/commands/build/mod.rs index 80165df0c..e2f74f571 100644 --- a/osdk/src/commands/build/mod.rs +++ b/osdk/src/commands/build/mod.rs @@ -205,7 +205,7 @@ fn build_kernel_elf( &env_rustflags, &rustc_linker_script_arg, "-C relocation-model=static", - "-Z relro-level=off", + "-C relro-level=off", // We do not really allow unwinding except for kernel testing. However, we need to specify // this to show backtraces when panicking. "-C panic=unwind",