1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-24 16:42:36 +02:00

Make Miri happy (#486)

I think this is a better solution than #308. It fixes the Miri error, and mostly keeps the original intent of demonstrating how to use raw pointers.
This commit is contained in:
Andrew Walbran 2023-03-15 23:18:12 +00:00 committed by GitHub
parent 7a22d5567a
commit daf25d094b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@ fn main() {
let mut num = 5;
let r1 = &mut num as *mut i32;
let r2 = &num as *const i32;
let r2 = r1 as *const i32;
// Safe because r1 and r2 were obtained from references and so are guaranteed to be non-null and
// properly aligned, the objects underlying the references from which they were obtained are