diff --git a/examples/bare0.rs b/examples/bare0.rs index 4e6507394d41ed3f703d6eaa6dfe7ac2cd3d1c22..c423a0629033b65212999965ca9666e992c53871 100644 --- a/examples/bare0.rs +++ b/examples/bare0.rs @@ -37,11 +37,10 @@ static mut Y: u32 = 0; fn main() -> ! { // local mutable variable (changed in safe code) let mut x = unsafe { X }; - loop { - x += 1; // <- place breakpoint here (3) + x = x.wrapping_add(1); // <- place breakpoint here (3) unsafe { - X += 1; + X = X.wrapping_add(1); Y = X; assert!(x == X && X == Y); } @@ -95,10 +94,10 @@ fn main() -> ! { // Change (both) += operations to use wrapping_add // load and run the program, what happens // ** your answer here ** -// +// x wraps around and becomes 0 and X doesnt change // Now continue execution, what happens // ** your answer here ** -// +// x continues to get bigger X is still the same // Commit your answers (bare0_3) // // (If the program did not succeed back to the breakpoint