Skip to content

Commit

Permalink
Fix rust-lang#3014 UB in listing-19-03
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram authored Jan 21, 2022
1 parent a4efcd5 commit 964fd72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion listings/ch19-advanced-features/listing-19-03/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ fn main() {
// ANCHOR: here
let mut num = 5;

let r1 = &num as *const i32;
let r2 = &mut num as *mut i32;
let r1 = unsafe { &*r2 as *const i32 };

unsafe {
println!("r1 is: {}", *r1);
Expand Down

0 comments on commit 964fd72

Please sign in to comment.