Update tests
This commit is contained in:
parent
d2f363ba89
commit
8c53d54b98
@ -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;
|
||||
},
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -23,6 +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
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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(){}
|
||||
|
Loading…
x
Reference in New Issue
Block a user