diff options
| author | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-06-27 13:36:30 +0200 |
|---|---|---|
| committer | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-06-28 11:04:25 +0200 |
| commit | 4eea1a4e5e28a9a84579ee6a52f115375adefde6 (patch) | |
| tree | e1cb8479f2e57b83a38e83060cf33025c08d5cb7 /src/test/compile-fail | |
| parent | 4bb9648b27e2c9f9efdb9e29a0d90b229aaff562 (diff) | |
| download | rust-4eea1a4e5e28a9a84579ee6a52f115375adefde6.tar.gz rust-4eea1a4e5e28a9a84579ee6a52f115375adefde6.zip | |
Don't const propagate the body of constants
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/const-err-early.rs | 6 | ||||
| -rw-r--r-- | src/test/compile-fail/const-err-multi.rs | 10 | ||||
| -rw-r--r-- | src/test/compile-fail/const-eval-overflow2.rs | 8 | ||||
| -rw-r--r-- | src/test/compile-fail/const-eval-overflow2b.rs | 8 | ||||
| -rw-r--r-- | src/test/compile-fail/const-eval-overflow2c.rs | 8 |
5 files changed, 1 insertions, 39 deletions
diff --git a/src/test/compile-fail/const-err-early.rs b/src/test/compile-fail/const-err-early.rs index 92c6b1fd0b5..39b1b342eac 100644 --- a/src/test/compile-fail/const-err-early.rs +++ b/src/test/compile-fail/const-err-early.rs @@ -11,16 +11,10 @@ #![deny(const_err)] pub const A: i8 = -std::i8::MIN; //~ ERROR const_err -//~^ ERROR this constant cannot be used -//~| ERROR this expression will panic at runtime pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err -//~^ ERROR this constant cannot be used pub const C: u8 = 200u8 * 4; //~ ERROR const_err -//~^ ERROR this constant cannot be used pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err -//~^ ERROR this constant cannot be used pub const E: u8 = [5u8][1]; //~ ERROR const_err -//~| ERROR this constant cannot be used fn main() { let _a = A; diff --git a/src/test/compile-fail/const-err-multi.rs b/src/test/compile-fail/const-err-multi.rs index 9405b4134bc..f2ee8a7078c 100644 --- a/src/test/compile-fail/const-err-multi.rs +++ b/src/test/compile-fail/const-err-multi.rs @@ -11,24 +11,16 @@ #![deny(const_err)] pub const A: i8 = -std::i8::MIN; -//~^ ERROR attempt to negate with overflow -//~| ERROR this expression will panic at runtime -//~| ERROR this constant cannot be used +//~^ ERROR this constant cannot be used pub const B: i8 = A; //~^ ERROR const_err //~| ERROR const_err -//~| ERROR const_err -//~| ERROR const_err pub const C: u8 = A as u8; //~^ ERROR const_err //~| ERROR const_err -//~| ERROR const_err -//~| ERROR const_err pub const D: i8 = 50 - A; //~^ ERROR const_err //~| ERROR const_err -//~| ERROR const_err -//~| ERROR const_err fn main() { let _ = (A, B, C, D); diff --git a/src/test/compile-fail/const-eval-overflow2.rs b/src/test/compile-fail/const-eval-overflow2.rs index 7b5db7a4f6d..88fc5182775 100644 --- a/src/test/compile-fail/const-eval-overflow2.rs +++ b/src/test/compile-fail/const-eval-overflow2.rs @@ -25,54 +25,46 @@ const VALS_I8: (i8,) = //~^ ERROR this constant cannot be used ( i8::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_I16: (i16,) = //~^ ERROR this constant cannot be used ( i16::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_I32: (i32,) = //~^ ERROR this constant cannot be used ( i32::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_I64: (i64,) = //~^ ERROR this constant cannot be used ( i64::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_U8: (u8,) = //~^ ERROR this constant cannot be used ( u8::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_U16: (u16,) = ( //~^ ERROR this constant cannot be used u16::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_U32: (u32,) = ( //~^ ERROR this constant cannot be used u32::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); const VALS_U64: (u64,) = //~^ ERROR this constant cannot be used ( u64::MIN - 1, - //~^ ERROR attempt to subtract with overflow ); fn main() { diff --git a/src/test/compile-fail/const-eval-overflow2b.rs b/src/test/compile-fail/const-eval-overflow2b.rs index ce4dc72555d..1878daea931 100644 --- a/src/test/compile-fail/const-eval-overflow2b.rs +++ b/src/test/compile-fail/const-eval-overflow2b.rs @@ -25,54 +25,46 @@ const VALS_I8: (i8,) = //~^ ERROR this constant cannot be used ( i8::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_I16: (i16,) = //~^ ERROR this constant cannot be used ( i16::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_I32: (i32,) = //~^ ERROR this constant cannot be used ( i32::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_I64: (i64,) = //~^ ERROR this constant cannot be used ( i64::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_U8: (u8,) = //~^ ERROR this constant cannot be used ( u8::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_U16: (u16,) = ( //~^ ERROR this constant cannot be used u16::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_U32: (u32,) = ( //~^ ERROR this constant cannot be used u32::MAX + 1, - //~^ ERROR attempt to add with overflow ); const VALS_U64: (u64,) = //~^ ERROR this constant cannot be used ( u64::MAX + 1, - //~^ ERROR attempt to add with overflow ); fn main() { diff --git a/src/test/compile-fail/const-eval-overflow2c.rs b/src/test/compile-fail/const-eval-overflow2c.rs index 88eb14a1330..f3d28295bf8 100644 --- a/src/test/compile-fail/const-eval-overflow2c.rs +++ b/src/test/compile-fail/const-eval-overflow2c.rs @@ -25,54 +25,46 @@ const VALS_I8: (i8,) = //~^ ERROR this constant cannot be used ( i8::MIN * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_I16: (i16,) = //~^ ERROR this constant cannot be used ( i16::MIN * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_I32: (i32,) = //~^ ERROR this constant cannot be used ( i32::MIN * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_I64: (i64,) = //~^ ERROR this constant cannot be used ( i64::MIN * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_U8: (u8,) = //~^ ERROR this constant cannot be used ( u8::MAX * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_U16: (u16,) = ( //~^ ERROR this constant cannot be used u16::MAX * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_U32: (u32,) = ( //~^ ERROR this constant cannot be used u32::MAX * 2, - //~^ ERROR attempt to multiply with overflow ); const VALS_U64: (u64,) = //~^ ERROR this constant cannot be used ( u64::MAX * 2, - //~^ ERROR attempt to multiply with overflow ); fn main() { |
