use 2018 edition for tests

This commit is contained in:
Ralf Jung 2018-11-20 12:41:34 +01:00
parent 3cfaed2dbd
commit 1ae536b03e
2 changed files with 7 additions and 7 deletions

View file

@ -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.

View file

@ -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);
}