Use &raw rather than addr_of macros.
This was added in Rust 1.82 which we now have in AOSP.
Test: m vmbase_example_kernel_bin
Change-Id: I5b3f3f47a261cb07d0eca3487005795d0cb050f6
diff --git a/guest/vmbase_example/src/main.rs b/guest/vmbase_example/src/main.rs
index f5b41bd..52a5f3e 100644
--- a/guest/vmbase_example/src/main.rs
+++ b/guest/vmbase_example/src/main.rs
@@ -26,7 +26,6 @@
use crate::layout::print_addresses;
use crate::pci::check_pci;
use alloc::{vec, vec::Vec};
-use core::ptr::addr_of_mut;
use libfdt::Fdt;
use log::{debug, error, info, trace, warn, LevelFilter};
use vmbase::{
@@ -101,6 +100,7 @@
);
}
+#[allow(static_mut_refs)]
fn check_data() {
info!("INITIALISED_DATA: {:?}", INITIALISED_DATA.as_ptr());
// SAFETY: We only print the addresses of the static mutable variable, not actually access it.
@@ -115,10 +115,10 @@
// SAFETY: Nowhere else in the program accesses this static mutable variable, so there is no
// chance of concurrent access.
- let zeroed_data = unsafe { &mut *addr_of_mut!(ZEROED_DATA) };
+ let zeroed_data = unsafe { &mut ZEROED_DATA };
// SAFETY: Nowhere else in the program accesses this static mutable variable, so there is no
// chance of concurrent access.
- let mutable_data = unsafe { &mut *addr_of_mut!(MUTABLE_DATA) };
+ let mutable_data = unsafe { &mut MUTABLE_DATA };
for element in zeroed_data.iter() {
assert_eq!(*element, 0);