Skip to content
Snippets Groups Projects
Commit 59d5a43d authored by Anton's avatar Anton
Browse files

bare4_2

parent 17d6b71c
No related branches found
No related tags found
No related merge requests found
...@@ -35,8 +35,8 @@ use address::*; ...@@ -35,8 +35,8 @@ use address::*;
#[inline(always)] #[inline(always)]
fn read_u32(addr: u32) -> u32 { fn read_u32(addr: u32) -> u32 {
unsafe { core::ptr::read_volatile(addr as *const _) } //unsafe { core::ptr::read_volatile(addr as *const _) }
// core::ptr::read_volatile(addr as *const _) core::ptr::read_volatile(addr as *const _);
} }
#[inline(always)] #[inline(always)]
...@@ -100,12 +100,13 @@ const APP: () = { ...@@ -100,12 +100,13 @@ const APP: () = {
// //
// What was the error message and explain why. // What was the error message and explain why.
// //
// ** your answer here ** // This operation is unsafe and requires an unsafe function or block.
// The function read_volatile is declared to be unsafe.
// //
// Digging a bit deeper, why do you think `read_volatile` is declared `unsafe`. // Digging a bit deeper, why do you think `read_volatile` is declared `unsafe`.
// (https://doc.rust-lang.org/core/ptr/fn.read_volatile.html, for some food for thought ) // (https://doc.rust-lang.org/core/ptr/fn.read_volatile.html, for some food for thought )
// //
// ** your answer here ** // It is unsafe because it can't guarantee the value is the expected value.
// //
// Commit your answers (bare4_2) // Commit your answers (bare4_2)
// //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment