From 41f948c9136ab7d4de076de90f0c6853f8fea169 Mon Sep 17 00:00:00 2001 From: wenhaozhao Date: Fri, 12 Jan 2024 16:40:39 +0800 Subject: [PATCH 1/3] fix compile error with rustc 1.77.0-nightly (62d7ed4a6 2024-01-11) mutable reference of mutable static is discouraged for more information, see issue #114447 reference of mutable static is a hard error from 2024 edition --- rustsbi-qemu/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rustsbi-qemu/src/main.rs b/rustsbi-qemu/src/main.rs index 2e2c58b..1269e62 100644 --- a/rustsbi-qemu/src/main.rs +++ b/rustsbi-qemu/src/main.rs @@ -72,8 +72,8 @@ extern "C" fn rust_main(hartid: usize, opaque: usize) { static mut ebss: u64; } unsafe { - let mut ptr = &mut sbss as *mut u64; - let end = &mut ebss as *mut u64; + let mut ptr = sbss as *mut u64; + let end = ebss as *mut u64; while ptr < end { ptr.write_volatile(0); ptr = ptr.offset(1); From 9b8103741fe4ddf8ea512c5cbd82d38c96f36c7c Mon Sep 17 00:00:00 2001 From: wenhaozhao Date: Mon, 22 Jan 2024 14:48:43 +0800 Subject: [PATCH 2/3] fix test module compile error with rustc 1.77.0-nightly (62d7ed4a6 2024-01-11) mutable reference of mutable static is discouraged for more information, see issue #114447 reference of mutable static is a hard error from 2024 edition --- test-kernel/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-kernel/src/main.rs b/test-kernel/src/main.rs index bbd5e06..91743c7 100644 --- a/test-kernel/src/main.rs +++ b/test-kernel/src/main.rs @@ -40,8 +40,8 @@ extern "C" fn rust_main(hartid: usize, dtb_pa: usize) -> ! { static mut ebss: u64; } unsafe { - let mut ptr = &mut sbss as *mut u64; - let end = &mut ebss as *mut u64; + let mut ptr = sbss as *mut u64; + let end = ebss as *mut u64; while ptr < end { ptr.write_volatile(0); ptr = ptr.offset(1); From adaf6df1bcabb867483db89f5abe56030aa025e8 Mon Sep 17 00:00:00 2001 From: wenhaozhao Date: Mon, 22 Jan 2024 14:50:02 +0800 Subject: [PATCH 3/3] fix bench-kernel module compile error with rustc 1.77.0-nightly (62d7ed4a6 2024-01-11) mutable reference of mutable static is discouraged for more information, see issue #114447 reference of mutable static is a hard error from 2024 edition --- bench-kernel/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bench-kernel/src/main.rs b/bench-kernel/src/main.rs index bba3760..572dbf3 100644 --- a/bench-kernel/src/main.rs +++ b/bench-kernel/src/main.rs @@ -33,8 +33,8 @@ extern "C" fn rust_main(hartid: usize, _dtb_pa: usize) -> ! { static mut ebss: u64; } unsafe { - let mut ptr = &mut sbss as *mut u64; - let end = &mut ebss as *mut u64; + let mut ptr = sbss as *mut u64; + let end = ebss as *mut u64; while ptr < end { ptr.write_volatile(0); ptr = ptr.offset(1);