From daf25d094b1f9b3aeec93a2c28c97108c0b0c215 Mon Sep 17 00:00:00 2001 From: Andrew Walbran Date: Wed, 15 Mar 2023 23:18:12 +0000 Subject: [PATCH] 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. --- src/unsafe/raw-pointers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unsafe/raw-pointers.md b/src/unsafe/raw-pointers.md index c5340e2e..fc9d0dbc 100644 --- a/src/unsafe/raw-pointers.md +++ b/src/unsafe/raw-pointers.md @@ -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