Skip to content

Commit 1858bec

Browse files
committed
Remove static-mut warnings.
1 parent 3a21af4 commit 1858bec

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

neotron-os/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ impl core::fmt::Write for Ctx {
356356
/// (as it doesn't know where they are).
357357
#[cfg(all(target_os = "none", not(feature = "lib-mode")))]
358358
unsafe fn start_up_init() {
359+
use core::ptr::{addr_of, addr_of_mut};
360+
359361
extern "C" {
360362

361363
// These symbols come from `link.x`
@@ -367,8 +369,12 @@ unsafe fn start_up_init() {
367369
static __sidata: u32;
368370
}
369371

370-
r0::zero_bss(&mut __sbss, &mut __ebss);
371-
r0::init_data(&mut __sdata, &mut __edata, &__sidata);
372+
r0::zero_bss(addr_of_mut!(__sbss), addr_of_mut!(__ebss));
373+
r0::init_data(
374+
addr_of_mut!(__sdata),
375+
addr_of_mut!(__edata),
376+
addr_of!(__sidata),
377+
);
372378
}
373379

374380
#[cfg(any(not(target_os = "none"), feature = "lib-mode"))]

neotron-os/src/program.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl TransientProgramArea {
181181
// points to, as the linker can only invent symbols pointing at
182182
// addresses; it cannot actually put values in RAM.
183183
#[cfg(all(target_os = "none", target_arch = "arm"))]
184-
let official_tpa_start: Option<*mut u32> = Some((&mut _tpa_start) as *mut u32);
184+
let official_tpa_start: Option<*mut u32> = Some(core::ptr::addr_of_mut!(_tpa_start));
185185

186186
#[cfg(not(all(target_os = "none", target_arch = "arm")))]
187187
let official_tpa_start: Option<*mut u32> = None;

0 commit comments

Comments
 (0)