let mut flags = Vec::new();
flags.push(format!("--sysroot {}", sysroot.display()));
flags.push("-Dwarnings -Dunused".to_owned()); // overwrite the -Aunused in compiletest-rs
+ flags.push("--edition 2018".to_owned());
if opt {
// Optimizing too aggressivley makes UB detection harder, but test at least
// the default value.
let mut flags = Vec::new();
flags.push(format!("--sysroot {}", sysroot.display()));
flags.push("-Dwarnings -Dunused".to_owned()); // overwrite the -Aunused in compiletest-rs
+ flags.push("--edition 2018".to_owned());
if opt {
// FIXME: We use opt level 1 because MIR inlining defeats the validation
// whitelist.
// That should work.
fn mut_raw_then_mut_shr() {
let mut x = 2;
- {
- let xref = &mut x;
- let xraw = &mut *xref as *mut _;
- let xshr = &*xref;
- assert_eq!(*xshr, 2);
- unsafe { *xraw = 4; }
- }
+ let xref = &mut x;
+ let xraw = &mut *xref as *mut _;
+ let xshr = &*xref;
+ assert_eq!(*xshr, 2);
+ unsafe { *xraw = 4; }
assert_eq!(x, 4);
}