Adjust tests to changed const err lints
This commit is contained in:
parent
4667346042
commit
e093ab0df4
@ -12,7 +12,6 @@
|
||||
#![deny(const_err)]
|
||||
|
||||
pub const A: i8 = -std::i8::MIN; //~ ERROR E0080
|
||||
//~^ ERROR attempt to negate with overflow
|
||||
//~| ERROR const_err
|
||||
//~| ERROR const_err
|
||||
pub const B: u8 = 200u8 + 200u8; //~ ERROR E0080
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#![deny(const_err)]
|
||||
|
||||
pub const A: i8 = -std::i8::MIN; //~ ERROR attempt to negate with overflow
|
||||
pub const A: i8 = -std::i8::MIN;
|
||||
//~^ ERROR E0080
|
||||
//~| ERROR const_err
|
||||
//~| ERROR const_err
|
||||
|
@ -9,89 +9,110 @@
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(const_err)]
|
||||
//~^ NOTE lint level defined here
|
||||
|
||||
use std::{isize, i8, i16, i32, i64};
|
||||
use std::thread;
|
||||
|
||||
fn main() {
|
||||
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
|
||||
//~^ ERROR attempt to divide with overflow
|
||||
//~^ NOTE attempt to divide with overflow
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
||||
//~^ ERROR attempt to divide with overflow
|
||||
//~^ NOTE attempt to divide with overflow
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
||||
//~^ ERROR attempt to divide with overflow
|
||||
//~^ NOTE attempt to divide with overflow
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
||||
//~^ ERROR attempt to divide with overflow
|
||||
//~^ NOTE attempt to divide with overflow
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
||||
//~^ ERROR attempt to divide with overflow
|
||||
//~^ NOTE attempt to divide with overflow
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
||||
//~^ ERROR attempt to divide by zero
|
||||
//~^ NOTE attempt to divide by zero
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
||||
//~^ ERROR attempt to divide by zero
|
||||
//~^ NOTE attempt to divide by zero
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
||||
//~^ ERROR attempt to divide by zero
|
||||
//~^ NOTE attempt to divide by zero
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
||||
//~^ ERROR attempt to divide by zero
|
||||
//~^ NOTE attempt to divide by zero
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
||||
//~^ ERROR attempt to divide by zero
|
||||
//~^ NOTE attempt to divide by zero
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
||||
//~^ ERROR attempt to calculate the remainder with overflow
|
||||
//~^ NOTE attempt to calculate the remainder with overflow
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
|
||||
//~^ ERROR attempt to calculate the remainder with overflow
|
||||
//~^ NOTE attempt to calculate the remainder with overflow
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
||||
//~^ ERROR attempt to calculate the remainder with overflow
|
||||
//~^ NOTE attempt to calculate the remainder with overflow
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
||||
//~^ ERROR attempt to calculate the remainder with overflow
|
||||
//~^ NOTE attempt to calculate the remainder with overflow
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
||||
//~^ ERROR attempt to calculate the remainder with overflow
|
||||
//~^ NOTE attempt to calculate the remainder with overflow
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
||||
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||
//~^ NOTE attempt to calculate the remainder with a divisor of zero
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
||||
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||
//~^ NOTE attempt to calculate the remainder with a divisor of zero
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
||||
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||
//~^ NOTE attempt to calculate the remainder with a divisor of zero
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
||||
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||
//~^ NOTE attempt to calculate the remainder with a divisor of zero
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
||||
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||
//~^ NOTE attempt to calculate the remainder with a divisor of zero
|
||||
//~| NOTE attempted to do overflowing math
|
||||
//~| ERROR constant evaluation error
|
||||
//~| ERROR constant evaluation error
|
||||
}
|
||||
|
@ -8,13 +8,13 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(exceeding_bitshifts)]
|
||||
#![allow(unused_variables, const_err)]
|
||||
#![deny(exceeding_bitshifts, const_err)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
fn main() {
|
||||
let n = 1u8 << (4+3);
|
||||
let n = 1u8 << (4+4); //~ ERROR: bitshift exceeds the type's number of bits
|
||||
let n = 1u8 << (4+4); //~ ERROR: const_err
|
||||
let n = 1i64 >> [63][0];
|
||||
let n = 1i64 >> [64][0]; // should be linting, needs to wait for const propagation
|
||||
|
||||
@ -22,6 +22,6 @@ fn main() {
|
||||
const BITS: usize = 32;
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
const BITS: usize = 64;
|
||||
let n = 1_isize << BITS; //~ ERROR: bitshift exceeds the type's number of bits
|
||||
let n = 1_usize << BITS; //~ ERROR: bitshift exceeds the type's number of bits
|
||||
let n = 1_isize << BITS; //~ ERROR: const_err
|
||||
let n = 1_usize << BITS; //~ ERROR: const_err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user