From 429d84f0681f048661a7377b7acb57eeee77baef Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 2 Dec 2018 11:14:24 +0100 Subject: [PATCH 1/2] remove/fix outdated FIXMEs in tests --- tests/compile-fail-fullmir/stacked_borrows/illegal_write2.rs | 4 ---- .../stacked_borrows/pointer_smuggling.rs | 5 ++--- tests/compiletest.rs | 2 +- tests/run-pass/dst-struct.rs | 3 ++- tests/run-pass/sums.rs | 3 --- tests/run-pass/vec-matching-fold.rs | 2 -- 6 files changed, 5 insertions(+), 14 deletions(-) diff --git a/tests/compile-fail-fullmir/stacked_borrows/illegal_write2.rs b/tests/compile-fail-fullmir/stacked_borrows/illegal_write2.rs index b53655c8214..f4fefaad5e2 100644 --- a/tests/compile-fail-fullmir/stacked_borrows/illegal_write2.rs +++ b/tests/compile-fail-fullmir/stacked_borrows/illegal_write2.rs @@ -1,7 +1,3 @@ -// We fail to detect this when neither this nor libstd are optimized/have retagging. -// FIXME: Investigate that. -// compile-flags: -Zmir-opt-level=0 - #![allow(unused_variables)] fn main() { diff --git a/tests/compile-fail-fullmir/stacked_borrows/pointer_smuggling.rs b/tests/compile-fail-fullmir/stacked_borrows/pointer_smuggling.rs index 68f3d2923b1..bd5e28b47e8 100644 --- a/tests/compile-fail-fullmir/stacked_borrows/pointer_smuggling.rs +++ b/tests/compile-fail-fullmir/stacked_borrows/pointer_smuggling.rs @@ -1,5 +1,3 @@ -#![allow(unused_variables)] - static mut PTR: *mut u8 = 0 as *mut _; fn fun1(x: &mut u8) { @@ -14,7 +12,8 @@ fn fun2() { } fn main() { - let val = &mut 0; // FIXME: This should also work with a local variable, but currently it does not. + let mut val = 0; + let val = &mut val; fun1(val); *val = 2; // this invalidates any raw ptrs `fun1` might have created. fun2(); // if they now use a raw ptr they break our reference diff --git a/tests/compiletest.rs b/tests/compiletest.rs index 7aa55ef6634..de693bd4632 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -106,7 +106,7 @@ fn miri_pass(sysroot: &Path, path: &str, target: &str, host: &str, need_fullmir: flags.push("-Zmir-opt-level=1".to_owned()); } if !have_fullmir() { - // Validation relies on the EscapeToRaw statements being emitted + // FIXME: Validation relies on the EscapeToRaw statements being emitted flags.push("-Zmiri-disable-validation".to_owned()); } diff --git a/tests/run-pass/dst-struct.rs b/tests/run-pass/dst-struct.rs index 0820614ab5c..6ef0a6330f7 100644 --- a/tests/run-pass/dst-struct.rs +++ b/tests/run-pass/dst-struct.rs @@ -127,8 +127,9 @@ pub fn main() { let f2 : Box> = f1; foo(&*f2); - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let f3 : Box> = Box::>::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }); foo(&*f3); + let f4 : Box> = box Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; + foo(&*f4); } diff --git a/tests/run-pass/sums.rs b/tests/run-pass/sums.rs index a8dfd5ed66a..daeba060a78 100644 --- a/tests/run-pass/sums.rs +++ b/tests/run-pass/sums.rs @@ -1,6 +1,3 @@ -// FIXME(solson): 32-bit mode doesn't test anything currently. -#![cfg_attr(target_pointer_width = "32", allow(dead_code))] - #[derive(Debug, PartialEq)] enum Unit { Unit(()) } // Force non-C-enum representation. diff --git a/tests/run-pass/vec-matching-fold.rs b/tests/run-pass/vec-matching-fold.rs index 1a30f875580..396846b2323 100644 --- a/tests/run-pass/vec-matching-fold.rs +++ b/tests/run-pass/vec-matching-fold.rs @@ -22,7 +22,6 @@ fn foldl(values: &[T], &[ref head, ref tail..] => foldl(tail, function(initial, head), function), &[] => { - // FIXME: call guards let res = initial.clone(); res } } @@ -39,7 +38,6 @@ fn foldr(values: &[T], &[ref head.., ref tail] => foldr(head, function(tail, initial), function), &[] => { - // FIXME: call guards let res = initial.clone(); res } } From 36a2b8952283e1cb86f4133ebd6ea778da1a5b50 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 2 Dec 2018 11:26:09 +0100 Subject: [PATCH 2/2] remove a whole lot of unnecessary attributes --- .../stacked_borrows/alias_through_mutation.rs | 2 -- .../compile-fail-fullmir/stacked_borrows/aliasing_mut1.rs | 4 +--- .../compile-fail-fullmir/stacked_borrows/aliasing_mut2.rs | 4 +--- .../compile-fail-fullmir/stacked_borrows/aliasing_mut3.rs | 4 +--- .../compile-fail-fullmir/stacked_borrows/aliasing_mut4.rs | 4 +--- .../stacked_borrows/buggy_split_at_mut.rs | 2 -- .../compile-fail-fullmir/stacked_borrows/illegal_write2.rs | 2 -- tests/compile-fail/never_transmute_humans.rs | 7 +------ tests/compile-fail/never_transmute_void.rs | 2 -- tests/compile-fail/validity/transmute_through_ptr.rs | 2 -- tests/run-pass/dst-struct.rs | 2 -- tests/run-pass/issue-31267-additional.rs | 4 +--- tests/run-pass/many_shr_bor.rs | 7 +++---- tests/run-pass/move-arg-2-unique.rs | 1 - tests/run-pass/move-arg-3-unique.rs | 1 - tests/run-pass/regions-lifetime-nonfree-late-bound.rs | 1 - 16 files changed, 9 insertions(+), 40 deletions(-) diff --git a/tests/compile-fail-fullmir/stacked_borrows/alias_through_mutation.rs b/tests/compile-fail-fullmir/stacked_borrows/alias_through_mutation.rs index 092f3f09ed1..db9ac93279f 100644 --- a/tests/compile-fail-fullmir/stacked_borrows/alias_through_mutation.rs +++ b/tests/compile-fail-fullmir/stacked_borrows/alias_through_mutation.rs @@ -1,5 +1,3 @@ -#![allow(unused_variables)] - // This makes a ref that was passed to us via &mut alias with things it should not alias with fn retarget(x: &mut &u32, target: &mut u32) { unsafe { *x = &mut *(target as *mut _); } diff --git a/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut1.rs b/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut1.rs index b82901985b7..9bced43f6e8 100644 --- a/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut1.rs +++ b/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut1.rs @@ -1,8 +1,6 @@ -#![allow(unused_variables)] - use std::mem; -pub fn safe(x: &mut i32, y: &mut i32) {} //~ ERROR barrier +pub fn safe(_x: &mut i32, _y: &mut i32) {} //~ ERROR barrier fn main() { let mut x = 0; diff --git a/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut2.rs b/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut2.rs index 69caddfa8c3..ea24f1bd274 100644 --- a/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut2.rs +++ b/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut2.rs @@ -1,8 +1,6 @@ -#![allow(unused_variables)] - use std::mem; -pub fn safe(x: &i32, y: &mut i32) {} //~ ERROR barrier +pub fn safe(_x: &i32, _y: &mut i32) {} //~ ERROR barrier fn main() { let mut x = 0; diff --git a/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut3.rs b/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut3.rs index d37f9e63f60..e564e878ddb 100644 --- a/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut3.rs +++ b/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut3.rs @@ -1,8 +1,6 @@ -#![allow(unused_variables)] - use std::mem; -pub fn safe(x: &mut i32, y: &i32) {} //~ ERROR does not exist on the stack +pub fn safe(_x: &mut i32, _y: &i32) {} //~ ERROR does not exist on the stack fn main() { let mut x = 0; diff --git a/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut4.rs b/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut4.rs index bf65d6e2303..15f67d0f872 100644 --- a/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut4.rs +++ b/tests/compile-fail-fullmir/stacked_borrows/aliasing_mut4.rs @@ -1,10 +1,8 @@ -#![allow(unused_variables)] - use std::mem; use std::cell::Cell; // Make sure &mut UnsafeCell also is exclusive -pub fn safe(x: &i32, y: &mut Cell) {} //~ ERROR barrier +pub fn safe(_x: &i32, _y: &mut Cell) {} //~ ERROR barrier fn main() { let mut x = 0; diff --git a/tests/compile-fail-fullmir/stacked_borrows/buggy_split_at_mut.rs b/tests/compile-fail-fullmir/stacked_borrows/buggy_split_at_mut.rs index a6daa5d93d7..959c6314690 100644 --- a/tests/compile-fail-fullmir/stacked_borrows/buggy_split_at_mut.rs +++ b/tests/compile-fail-fullmir/stacked_borrows/buggy_split_at_mut.rs @@ -1,5 +1,3 @@ -#![allow(unused_variables)] - mod safe { use std::slice::from_raw_parts_mut; diff --git a/tests/compile-fail-fullmir/stacked_borrows/illegal_write2.rs b/tests/compile-fail-fullmir/stacked_borrows/illegal_write2.rs index f4fefaad5e2..ba3b6686b84 100644 --- a/tests/compile-fail-fullmir/stacked_borrows/illegal_write2.rs +++ b/tests/compile-fail-fullmir/stacked_borrows/illegal_write2.rs @@ -1,5 +1,3 @@ -#![allow(unused_variables)] - fn main() { let target = &mut 42; let target2 = target as *mut _; diff --git a/tests/compile-fail/never_transmute_humans.rs b/tests/compile-fail/never_transmute_humans.rs index 169e861be0b..34203338696 100644 --- a/tests/compile-fail/never_transmute_humans.rs +++ b/tests/compile-fail/never_transmute_humans.rs @@ -2,17 +2,12 @@ // compile-flags: -Zmiri-disable-validation #![feature(never_type)] -#![allow(unreachable_code)] -#![allow(unused_variables)] struct Human; fn main() { - let x: ! = unsafe { + let _x: ! = unsafe { std::mem::transmute::(Human) //~ ERROR constant evaluation error //^~ NOTE entered unreachable code }; - f(x) } - -fn f(x: !) -> ! { x } diff --git a/tests/compile-fail/never_transmute_void.rs b/tests/compile-fail/never_transmute_void.rs index 9c0165fed22..fab4981047f 100644 --- a/tests/compile-fail/never_transmute_void.rs +++ b/tests/compile-fail/never_transmute_void.rs @@ -2,8 +2,6 @@ // compile-flags: -Zmiri-disable-validation #![feature(never_type)] -#![allow(unreachable_code)] -#![allow(unused_variables)] enum Void {} diff --git a/tests/compile-fail/validity/transmute_through_ptr.rs b/tests/compile-fail/validity/transmute_through_ptr.rs index d6bc0305e69..4b6a3c95928 100644 --- a/tests/compile-fail/validity/transmute_through_ptr.rs +++ b/tests/compile-fail/validity/transmute_through_ptr.rs @@ -1,5 +1,3 @@ -#![allow(unused_variables)] - #[repr(u32)] enum Bool { True } diff --git a/tests/run-pass/dst-struct.rs b/tests/run-pass/dst-struct.rs index 6ef0a6330f7..4c9e598e6ba 100644 --- a/tests/run-pass/dst-struct.rs +++ b/tests/run-pass/dst-struct.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unused_features)] #![feature(box_syntax)] struct Fat { diff --git a/tests/run-pass/issue-31267-additional.rs b/tests/run-pass/issue-31267-additional.rs index 14e38f43c52..aaeeef8bf98 100644 --- a/tests/run-pass/issue-31267-additional.rs +++ b/tests/run-pass/issue-31267-additional.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unused_variables)] - #[derive(Clone, Copy, Debug)] struct Bar; @@ -25,5 +23,5 @@ impl Biz { } fn main() { - let foo = Biz::BAZ; + let _foo = Biz::BAZ; } diff --git a/tests/run-pass/many_shr_bor.rs b/tests/run-pass/many_shr_bor.rs index 393bafebfe4..d4901abb808 100644 --- a/tests/run-pass/many_shr_bor.rs +++ b/tests/run-pass/many_shr_bor.rs @@ -1,5 +1,4 @@ // Make sure validation can handle many overlapping shared borrows for different parts of a data structure -#![allow(unused_variables)] use std::cell::RefCell; struct Test { @@ -25,9 +24,9 @@ fn test2(r: &mut RefCell) { let x = &*r; // releasing write lock, first suspension recorded let mut x_ref = x.borrow_mut(); let x_inner : &mut i32 = &mut *x_ref; // new inner write lock, with same lifetime as outer lock - let x_inner_shr = &*x_inner; // releasing inner write lock, recording suspension - let y = &*r; // second suspension for the outer write lock - let x_inner_shr2 = &*x_inner; // 2nd suspension for inner write lock + let _x_inner_shr = &*x_inner; // releasing inner write lock, recording suspension + let _y = &*r; // second suspension for the outer write lock + let _x_inner_shr2 = &*x_inner; // 2nd suspension for inner write lock } fn main() { diff --git a/tests/run-pass/move-arg-2-unique.rs b/tests/run-pass/move-arg-2-unique.rs index d44c83763b7..77f763888ea 100644 --- a/tests/run-pass/move-arg-2-unique.rs +++ b/tests/run-pass/move-arg-2-unique.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unused_features, unused_variables)] #![feature(box_syntax)] fn test(foo: Box> ) { assert_eq!((*foo)[0], 10); } diff --git a/tests/run-pass/move-arg-3-unique.rs b/tests/run-pass/move-arg-3-unique.rs index 2e6320eb802..0754a3f60d3 100644 --- a/tests/run-pass/move-arg-3-unique.rs +++ b/tests/run-pass/move-arg-3-unique.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unused_features, unused_variables)] #![feature(box_syntax)] pub fn main() { diff --git a/tests/run-pass/regions-lifetime-nonfree-late-bound.rs b/tests/run-pass/regions-lifetime-nonfree-late-bound.rs index 96f1217a254..dfdf89c9c1c 100644 --- a/tests/run-pass/regions-lifetime-nonfree-late-bound.rs +++ b/tests/run-pass/regions-lifetime-nonfree-late-bound.rs @@ -22,7 +22,6 @@ // doing region-folding, when really all clients of the region-folding // case only want to see FREE lifetime variables, not bound ones. -#![allow(unused_features)] #![feature(box_syntax)] pub fn main() {