Skip to content

Commit 00dfff1

Browse files
committed
Bump Rust version to nightly-2025-02-18(2024 Edition)
1 parent 3e23ab7 commit 00dfff1

File tree

6 files changed

+22
-24
lines changed

6 files changed

+22
-24
lines changed

.github/workflows/doc-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push]
44

55
env:
66
CARGO_TERM_COLOR: always
7-
rust_toolchain: nightly-2024-01-18
7+
rust_toolchain: nightly-2025-02-18
88

99
jobs:
1010
build-doc:

os/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "os"
33
version = "0.1.0"
44
authors = ["Yifan Wu <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66

77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

os/src/lang_items.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ fn panic(info: &PanicInfo) -> ! {
1111
"[kernel] Panicked at {}:{} {}",
1212
location.file(),
1313
location.line(),
14-
info.message().unwrap()
14+
info.message()
1515
);
1616
} else {
17-
error!("[kernel] Panicked: {}", info.message().unwrap());
17+
error!("[kernel] Panicked: {}", info.message());
1818
}
1919
shutdown(true)
2020
}

os/src/main.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![deny(warnings)]
1212
#![no_std]
1313
#![no_main]
14-
#![feature(panic_info_message)]
1514

1615
use core::arch::global_asm;
1716
use log::*;
@@ -26,35 +25,34 @@ global_asm!(include_str!("entry.asm"));
2625

2726
/// clear BSS segment
2827
pub fn clear_bss() {
29-
extern "C" {
30-
fn sbss();
31-
fn ebss();
28+
unsafe extern "C" {
29+
safe fn sbss();
30+
safe fn ebss();
3231
}
3332
(sbss as usize..ebss as usize).for_each(|a| unsafe { (a as *mut u8).write_volatile(0) });
3433
}
3534

3635
/// the rust entry-point of os
37-
#[no_mangle]
36+
#[unsafe(no_mangle)]
3837
pub fn rust_main() -> ! {
39-
extern "C" {
40-
fn stext(); // begin addr of text segment
41-
fn etext(); // end addr of text segment
42-
fn srodata(); // start addr of Read-Only data segment
43-
fn erodata(); // end addr of Read-Only data ssegment
44-
fn sdata(); // start addr of data segment
45-
fn edata(); // end addr of data segment
46-
fn sbss(); // start addr of BSS segment
47-
fn ebss(); // end addr of BSS segment
48-
fn boot_stack_lower_bound(); // stack lower bound
49-
fn boot_stack_top(); // stack top
38+
unsafe extern "C" {
39+
safe fn stext(); // begin addr of text segment
40+
safe fn etext(); // end addr of text segment
41+
safe fn srodata(); // start addr of Read-Only data segment
42+
safe fn erodata(); // end addr of Read-Only data ssegment
43+
safe fn sdata(); // start addr of data segment
44+
safe fn edata(); // end addr of data segment
45+
safe fn sbss(); // start addr of BSS segment
46+
safe fn ebss(); // end addr of BSS segment
47+
safe fn boot_stack_lower_bound(); // stack lower bound
48+
safe fn boot_stack_top(); // stack top
5049
}
5150
clear_bss();
5251
logging::init();
5352
println!("[kernel] Hello, world!");
5453
trace!(
5554
"[kernel] .text [{:#x}, {:#x})",
56-
stext as usize,
57-
etext as usize
55+
stext as usize, etext as usize
5856
);
5957
debug!(
6058
"[kernel] .rodata [{:#x}, {:#x})",

os/src/sbi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn console_getchar() -> usize {
1414

1515
/// use sbi call to shutdown the kernel
1616
pub fn shutdown(failure: bool) -> ! {
17-
use sbi_rt::{system_reset, NoReason, Shutdown, SystemFailure};
17+
use sbi_rt::{NoReason, Shutdown, SystemFailure, system_reset};
1818
if !failure {
1919
system_reset(Shutdown, NoReason);
2020
} else {

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[toolchain]
22
profile = "minimal"
33
# use the nightly version of the last stable toolchain, see <https://forge.rust-lang.org/>
4-
channel = "nightly-2024-05-01"
4+
channel = "nightly-2025-02-18"
55
components = ["rust-src", "llvm-tools", "rustfmt", "clippy"]
66
targets = ["riscv64gc-unknown-none-elf"]

0 commit comments

Comments
 (0)