diff --git a/tests/compiletest.rs b/tests/compiletest.rs index 7ecf64590b61..7aa55ef66340 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -62,6 +62,7 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, need_fullm 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. @@ -98,6 +99,7 @@ fn miri_pass(sysroot: &Path, path: &str, target: &str, host: &str, need_fullmir: 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. diff --git a/tests/run-pass/stacked-borrows.rs b/tests/run-pass/stacked-borrows.rs index 7b7a7c9be203..72f26763be14 100644 --- a/tests/run-pass/stacked-borrows.rs +++ b/tests/run-pass/stacked-borrows.rs @@ -68,13 +68,11 @@ fn mut_shr_raw() { // 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); }