Update compile-fail tests
This commit is contained in:
parent
f68dc0190a
commit
f363e08c9d
9 changed files with 24 additions and 89 deletions
|
@ -11,7 +11,6 @@
|
|||
const A: &'static [i32] = &[];
|
||||
const B: i32 = (&A)[1];
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| ERROR E0080
|
||||
//~| index out of bounds: the len is 0 but the index is 1
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
const A: [i32; 0] = [];
|
||||
const B: i32 = A[1];
|
||||
//~^ ERROR constant evaluation error
|
||||
//~| ERROR E0080
|
||||
//~| index out of bounds: the len is 0 but the index is 1
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -13,16 +13,11 @@
|
|||
pub const A: i8 = -std::i8::MIN; //~ ERROR E0080
|
||||
//~| ERROR const_err
|
||||
//~| ERROR const_err
|
||||
//~| ERROR E0080
|
||||
pub const B: u8 = 200u8 + 200u8; //~ ERROR E0080
|
||||
//~| ERROR E0080
|
||||
pub const C: u8 = 200u8 * 4; //~ ERROR E0080
|
||||
//~| ERROR E0080
|
||||
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR E0080
|
||||
//~| ERROR E0080
|
||||
pub const E: u8 = [5u8][1];
|
||||
//~^ ERROR E0080
|
||||
//~| ERROR E0080
|
||||
|
||||
fn main() {
|
||||
let _a = A;
|
||||
|
|
|
@ -14,19 +14,12 @@ 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
|
||||
//~| ERROR E0080
|
||||
pub const C: u8 = A as u8;
|
||||
//~^ ERROR E0080
|
||||
//~| ERROR E0080
|
||||
pub const D: i8 = 50 - A;
|
||||
//~^ ERROR E0080
|
||||
//~| ERROR E0080
|
||||
|
||||
fn main() {
|
||||
let _ = (A, B, C, D);
|
||||
|
|
|
@ -23,9 +23,7 @@ fn black_box<T>(_: 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
|
||||
|
||||
fn main() {
|
||||
black_box((FOO, FOO));
|
||||
|
|
|
@ -22,65 +22,49 @@ use std::{i8, i16, i32, i64, isize};
|
|||
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() {
|
||||
|
|
|
@ -22,65 +22,49 @@ use std::{i8, i16, i32, i64, isize};
|
|||
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() {
|
||||
|
|
|
@ -22,65 +22,49 @@ use std::{i8, i16, i32, i64, isize};
|
|||
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() {
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
const FOO: &'static[u32] = &[1, 2, 3];
|
||||
const BAR: u32 = FOO[5];
|
||||
//~^ ERROR constant evaluation error [E0080]
|
||||
//~| ERROR constant evaluation error [E0080]
|
||||
//~| index out of bounds: the len is 3 but the index is 5
|
||||
|
||||
fn main() {
|
||||
|
|
Loading…
Reference in a new issue