Consider the following code:
unsafe {
let mut s = "".to_string();
let r = &mut s;
let ptr = r as *mut String;
r.push('a');
(*ptr).push('b');
r.push('c');
(*ptr).push('d');
println!("{}", r);
}
I would think that this is a clear violation of Rust aliasing rules: I have a mutable reference and a mutable pointer, and there are interleaving writes using both of them. However, MIRI lets it pass. What am I missing?