Enable the overflow-related tests for MIR
This commit is contained in:
parent
f2c983b248
commit
bcdb2602f8
20 changed files with 0 additions and 39 deletions
|
@ -11,7 +11,6 @@
|
||||||
// these errors are not actually "const_err", they occur in trans/consts
|
// these errors are not actually "const_err", they occur in trans/consts
|
||||||
// and are unconditional warnings that can't be denied or allowed
|
// and are unconditional warnings that can't be denied or allowed
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#![allow(exceeding_bitshifts)]
|
#![allow(exceeding_bitshifts)]
|
||||||
#![allow(const_err)]
|
#![allow(const_err)]
|
||||||
|
|
||||||
|
@ -24,7 +23,6 @@ const FOO: u8 = [5u8][1];
|
||||||
//~^ ERROR array index out of bounds
|
//~^ ERROR array index out of bounds
|
||||||
//~^^ ERROR array index out of bounds
|
//~^^ ERROR array index out of bounds
|
||||||
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = -std::i8::MIN;
|
let a = -std::i8::MIN;
|
||||||
//~^ WARN attempted to negate with overflow
|
//~^ WARN attempted to negate with overflow
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#![allow(unused_imports)]
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
// Note: the relevant lint pass here runs before some of the constant
|
// Note: the relevant lint pass here runs before some of the constant
|
||||||
|
@ -104,7 +103,6 @@ const VALS_U64: (u64, u64, u64, u64) =
|
||||||
//~^ ERROR attempted to multiply with overflow
|
//~^ ERROR attempted to multiply with overflow
|
||||||
);
|
);
|
||||||
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
foo(VALS_I8);
|
foo(VALS_I8);
|
||||||
foo(VALS_I16);
|
foo(VALS_I16);
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
// error-pattern:attempted to divide by zero
|
// error-pattern:attempted to divide by zero
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let y = 0;
|
let y = 0;
|
||||||
let _z = 1 / y;
|
let _z = 1 / y;
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
// error-pattern:attempted remainder with a divisor of zero
|
// error-pattern:attempted remainder with a divisor of zero
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let y = 0;
|
let y = 0;
|
||||||
let _z = 1 % y;
|
let _z = 1 % y;
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _x = 200u8 + 200u8 + 200u8;
|
let _x = 200u8 + 200u8 + 200u8;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _x = 1_i32 << 32;
|
let _x = 1_i32 << 32;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _x = 1 << -1;
|
let _x = 1 << -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _x = 1_u64 << 64;
|
let _x = 1_u64 << 64;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// this signals overflow when checking is on
|
// this signals overflow when checking is on
|
||||||
let x = 1_i8 << 17;
|
let x = 1_i8 << 17;
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
// error-pattern:thread 'main' panicked at 'arithmetic operation overflowed'
|
// error-pattern:thread 'main' panicked at 'arithmetic operation overflowed'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = 200u8 * 4;
|
let x = 200u8 * 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to negate with overflow'
|
// error-pattern:thread 'main' panicked at 'attempted to negate with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _x = -std::i8::MIN;
|
let _x = -std::i8::MIN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _x = -1_i32 >> 32;
|
let _x = -1_i32 >> 32;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _x = -1_i32 >> -1;
|
let _x = -1_i32 >> -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _x = -1_i64 >> 64;
|
let _x = -1_i64 >> 64;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// this signals overflow when checking is on
|
// this signals overflow when checking is on
|
||||||
let x = 2_i8 >> 17;
|
let x = 2_i8 >> 17;
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _n = 1i64 >> [64][0];
|
let _n = 1i64 >> [64][0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
#![feature(const_indexing)]
|
#![feature(const_indexing)]
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _n = 1i64 >> [64][0];
|
let _n = 1i64 >> [64][0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
// error-pattern:thread 'main' panicked at 'arithmetic operation overflowed'
|
// error-pattern:thread 'main' panicked at 'arithmetic operation overflowed'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _x = 42u8 - (42u8 + 1);
|
let _x = 42u8 - (42u8 + 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ fn debug_assert() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn overflow() {
|
fn overflow() {
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn add(a: u8, b: u8) -> u8 { a + b }
|
fn add(a: u8, b: u8) -> u8 { a + b }
|
||||||
|
|
||||||
add(200u8, 200u8);
|
add(200u8, 200u8);
|
||||||
|
|
|
@ -19,13 +19,11 @@ use std::thread;
|
||||||
macro_rules! check {
|
macro_rules! check {
|
||||||
($($e:expr),*) => {
|
($($e:expr),*) => {
|
||||||
$(assert!(thread::spawn({
|
$(assert!(thread::spawn({
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
move|| { $e; }
|
move|| { $e; }
|
||||||
}).join().is_err());)*
|
}).join().is_err());)*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
|
|
||||||
fn main() {
|
fn main() {
|
||||||
check![
|
check![
|
||||||
isize::min_value() / -1,
|
isize::min_value() / -1,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue