Hi everyone!
If I've understood it correctly, the rules of stacked borrows are same as the rules enforced by the borrow checker but they also work on unsafe code (raw pointers) and we could use miri to detect them, right?
If what I've said is correct, then why miri isn't complaining about this? Isn't this a violation of stacked borrows?
fn main() { let x = Box::into_raw(Box::new(String::from("this"))); let y = unsafe { &mut *x } as *mut String; println!("x: {:p}, y: {:p}", x, y); // violation? // miri happy :) drop(unsafe { Box::from_raw(x) }); } 6 posts - 2 participants
