diff --git a/examples/bare4.rs b/examples/bare4.rs index e0782aedde69fc6b3ec530eb488d972243566b41..ea704536050ad42b0777979216cc753e4775e15d 100644 --- a/examples/bare4.rs +++ b/examples/bare4.rs @@ -101,12 +101,15 @@ fn main() -> ! { // // What was the error message and explain why. // -// ** your answer here ** +// Error message recieved "call to unsafe function". This is because the function being called +// is volatile, and has to be run in a unsafe function or block. // // 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 ) // -// ** your answer here ** +// read_volatile is a declared volatile operation, and thus are guarenteed to not be the same +// when read at different occassions. Declaring it as unsafe disables the rust memory guarentee, which +// allows the volatile function to read the memory. // // Commit your answers (bare4_2) //