mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-25 16:54:32 +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:
parent
7a22d5567a
commit
daf25d094b
@ -7,7 +7,7 @@ fn main() {
|
|||||||
let mut num = 5;
|
let mut num = 5;
|
||||||
|
|
||||||
let r1 = &mut num as *mut i32;
|
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
|
// 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
|
// properly aligned, the objects underlying the references from which they were obtained are
|
||||||
|
Loading…
x
Reference in New Issue
Block a user