Warn on all erroneous constants
This commit is contained in:
parent
52ed3d8761
commit
cd6c186e4e
18 changed files with 233 additions and 75 deletions
|
@ -22,57 +22,57 @@ use std::{i8, i16, i32, i64, isize};
|
|||
use std::{u8, u16, u32, u64, usize};
|
||||
|
||||
const VALS_I8: (i8,) =
|
||||
//~^ ERROR this constant cannot be used
|
||||
(
|
||||
i8::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| ERROR attempt to subtract with overflow
|
||||
//~^ ERROR attempt to subtract with overflow
|
||||
);
|
||||
|
||||
const VALS_I16: (i16,) =
|
||||
//~^ ERROR this constant cannot be used
|
||||
(
|
||||
i16::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| ERROR attempt to subtract with overflow
|
||||
//~^ ERROR attempt to subtract with overflow
|
||||
);
|
||||
|
||||
const VALS_I32: (i32,) =
|
||||
//~^ ERROR this constant cannot be used
|
||||
(
|
||||
i32::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| ERROR attempt to subtract with overflow
|
||||
//~^ ERROR attempt to subtract with overflow
|
||||
);
|
||||
|
||||
const VALS_I64: (i64,) =
|
||||
//~^ ERROR this constant cannot be used
|
||||
(
|
||||
i64::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| ERROR attempt to subtract with overflow
|
||||
//~^ ERROR attempt to subtract with overflow
|
||||
);
|
||||
|
||||
const VALS_U8: (u8,) =
|
||||
//~^ ERROR this constant cannot be used
|
||||
(
|
||||
u8::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| ERROR attempt to subtract with overflow
|
||||
//~^ ERROR attempt to subtract with overflow
|
||||
);
|
||||
|
||||
const VALS_U16: (u16,) = (
|
||||
//~^ ERROR this constant cannot be used
|
||||
u16::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| ERROR attempt to subtract with overflow
|
||||
//~^ ERROR attempt to subtract with overflow
|
||||
);
|
||||
|
||||
const VALS_U32: (u32,) = (
|
||||
//~^ ERROR this constant cannot be used
|
||||
u32::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| ERROR attempt to subtract with overflow
|
||||
//~^ ERROR attempt to subtract with overflow
|
||||
);
|
||||
|
||||
const VALS_U64: (u64,) =
|
||||
//~^ ERROR this constant cannot be used
|
||||
(
|
||||
u64::MIN - 1,
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| ERROR attempt to subtract with overflow
|
||||
//~^ ERROR attempt to subtract with overflow
|
||||
);
|
||||
|
||||
fn main() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue