From 8c53d54b98edd77e32fbf4f4fd27d312b251ec6b Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Wed, 31 Jan 2018 10:20:30 +0100 Subject: [PATCH] Update tests --- src/librustc_mir/transform/const_prop.rs | 2 +- src/test/compile-fail/const-err-multi.rs | 3 +++ src/test/compile-fail/const-err.rs | 1 + src/test/compile-fail/const-eval-overflow2.rs | 16 ++++++++-------- src/test/compile-fail/const-eval-overflow2b.rs | 16 ++++++++-------- src/test/compile-fail/const-eval-overflow2c.rs | 16 ++++++++-------- src/test/ui/infinite-recursion-const-fn.rs | 4 ++-- 7 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 9dee1e1633e..e0203953fb2 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -81,7 +81,7 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> { let value = match self.tcx.const_eval(self.param_env.and(cid)) { Ok(val) => val, Err(err) => { - err.report(self.tcx, span, "const prop"); + err.report(self.tcx, span, "constant propagated"); return None; }, }; diff --git a/src/test/compile-fail/const-err-multi.rs b/src/test/compile-fail/const-err-multi.rs index 1e3150a74d9..5dd8651005d 100644 --- a/src/test/compile-fail/const-err-multi.rs +++ b/src/test/compile-fail/const-err-multi.rs @@ -14,6 +14,9 @@ pub const A: i8 = -std::i8::MIN; //~^ ERROR E0080 //~| ERROR const_err //~| ERROR const_err +//~| ERROR constant evaluation error +//~| ERROR constant evaluation error +//~| ERROR constant evaluation error //~| ERROR E0080 pub const B: i8 = A; //~^ ERROR E0080 diff --git a/src/test/compile-fail/const-err.rs b/src/test/compile-fail/const-err.rs index 5f55cc82e6d..b0cf639cd76 100644 --- a/src/test/compile-fail/const-err.rs +++ b/src/test/compile-fail/const-err.rs @@ -23,6 +23,7 @@ fn black_box(_: T) { // Make sure that the two uses get two errors. const FOO: u8 = [5u8][1]; //~^ ERROR constant evaluation error +//~| ERROR constant evaluation error //~| index out of bounds: the len is 1 but the index is 1 //~| ERROR E0080 diff --git a/src/test/compile-fail/const-eval-overflow2.rs b/src/test/compile-fail/const-eval-overflow2.rs index ef1cdb2814f..d715847e03f 100644 --- a/src/test/compile-fail/const-eval-overflow2.rs +++ b/src/test/compile-fail/const-eval-overflow2.rs @@ -23,64 +23,64 @@ use std::{u8, u16, u32, u64, usize}; const VALS_I8: (i8,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to subtract with overflow ( i8::MIN - 1, - //~^ ERROR constant evaluation error ); const VALS_I16: (i16,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to subtract with overflow ( i16::MIN - 1, - //~^ ERROR constant evaluation error ); const VALS_I32: (i32,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to subtract with overflow ( i32::MIN - 1, - //~^ ERROR constant evaluation error ); const VALS_I64: (i64,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to subtract with overflow ( i64::MIN - 1, - //~^ ERROR constant evaluation error ); const VALS_U8: (u8,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to subtract with overflow ( u8::MIN - 1, - //~^ ERROR constant evaluation error ); const VALS_U16: (u16,) = ( //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to subtract with overflow u16::MIN - 1, - //~^ ERROR constant evaluation error ); const VALS_U32: (u32,) = ( //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to subtract with overflow u32::MIN - 1, - //~^ ERROR constant evaluation error ); const VALS_U64: (u64,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to subtract with overflow ( u64::MIN - 1, - //~^ ERROR constant evaluation error ); fn main() { diff --git a/src/test/compile-fail/const-eval-overflow2b.rs b/src/test/compile-fail/const-eval-overflow2b.rs index 347ba7603e2..f6463900eeb 100644 --- a/src/test/compile-fail/const-eval-overflow2b.rs +++ b/src/test/compile-fail/const-eval-overflow2b.rs @@ -23,64 +23,64 @@ use std::{u8, u16, u32, u64, usize}; const VALS_I8: (i8,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to add with overflow ( i8::MAX + 1, - //~^ ERROR constant evaluation error ); const VALS_I16: (i16,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to add with overflow ( i16::MAX + 1, - //~^ ERROR constant evaluation error ); const VALS_I32: (i32,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to add with overflow ( i32::MAX + 1, - //~^ ERROR constant evaluation error ); const VALS_I64: (i64,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to add with overflow ( i64::MAX + 1, - //~^ ERROR constant evaluation error ); const VALS_U8: (u8,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to add with overflow ( u8::MAX + 1, - //~^ ERROR constant evaluation error ); const VALS_U16: (u16,) = ( //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to add with overflow u16::MAX + 1, - //~^ ERROR constant evaluation error ); const VALS_U32: (u32,) = ( //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to add with overflow u32::MAX + 1, - //~^ ERROR constant evaluation error ); const VALS_U64: (u64,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to add with overflow ( u64::MAX + 1, - //~^ ERROR constant evaluation error ); fn main() { diff --git a/src/test/compile-fail/const-eval-overflow2c.rs b/src/test/compile-fail/const-eval-overflow2c.rs index 5ebbab1b649..8665b9d97a8 100644 --- a/src/test/compile-fail/const-eval-overflow2c.rs +++ b/src/test/compile-fail/const-eval-overflow2c.rs @@ -23,64 +23,64 @@ use std::{u8, u16, u32, u64, usize}; const VALS_I8: (i8,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to multiply with overflow ( i8::MIN * 2, - //~^ ERROR constant evaluation error ); const VALS_I16: (i16,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to multiply with overflow ( i16::MIN * 2, - //~^ ERROR constant evaluation error ); const VALS_I32: (i32,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to multiply with overflow ( i32::MIN * 2, - //~^ ERROR constant evaluation error ); const VALS_I64: (i64,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to multiply with overflow ( i64::MIN * 2, - //~^ ERROR constant evaluation error ); const VALS_U8: (u8,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to multiply with overflow ( u8::MAX * 2, - //~^ ERROR constant evaluation error ); const VALS_U16: (u16,) = ( //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to multiply with overflow u16::MAX * 2, - //~^ ERROR constant evaluation error ); const VALS_U32: (u32,) = ( //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to multiply with overflow u32::MAX * 2, - //~^ ERROR constant evaluation error ); const VALS_U64: (u64,) = //~^ ERROR constant evaluation error + //~| ERROR constant evaluation error //~| attempt to multiply with overflow ( u64::MAX * 2, - //~^ ERROR constant evaluation error ); fn main() { diff --git a/src/test/ui/infinite-recursion-const-fn.rs b/src/test/ui/infinite-recursion-const-fn.rs index f98074bc554..05e40abdc0f 100644 --- a/src/test/ui/infinite-recursion-const-fn.rs +++ b/src/test/ui/infinite-recursion-const-fn.rs @@ -11,8 +11,8 @@ //https://github.com/rust-lang/rust/issues/31364 #![feature(const_fn)] -const fn a() -> usize { b() } //~ ERROR constant evaluation error +const fn a() -> usize { b() } const fn b() -> usize { a() } -const ARR: [i32; a()] = [5; 6]; +const ARR: [i32; a()] = [5; 6]; //~ ERROR constant evaluation error fn main(){}