Fallout from changes for overflow-checking during constant evaluation.
This commit is contained in:
parent
6808e414c7
commit
8d54ea3ec9
|
@ -20,7 +20,7 @@ mod tests {
|
|||
fn test_overflows() {
|
||||
assert!(MAX > 0);
|
||||
assert!(MIN <= 0);
|
||||
assert!(MIN + MAX + 1 == 0);
|
||||
assert!((MIN + MAX).wrapping_add(1) == 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -519,7 +519,8 @@ mod bench {
|
|||
({
|
||||
use super::u64_from_be_bytes;
|
||||
|
||||
let data = (0..$stride*100+$start_index).collect::<Vec<_>>();
|
||||
let len = $stride.wrapping_mul(100).wrapping_add($start_index);
|
||||
let data = (0..len).collect::<Vec<_>>();
|
||||
let mut sum = 0;
|
||||
$b.iter(|| {
|
||||
let mut i = $start_index;
|
||||
|
|
|
@ -8,9 +8,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Note: This test is checking that we forbid a coding pattern that
|
||||
// Issue #5873 explicitly wants to allow.
|
||||
|
||||
enum State { ST_NULL, ST_WHITESPACE }
|
||||
|
||||
fn main() {
|
||||
[State::ST_NULL; (State::ST_WHITESPACE as usize)];
|
||||
//~^ ERROR expected constant integer for repeat count, found non-constant expression
|
||||
//~^ ERROR expected constant integer for repeat count, but non-constant path
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
fn main() {
|
||||
fn bar(n: usize) {
|
||||
let _x = [0; n]; //~ ERROR expected constant integer for repeat count, found variable
|
||||
let _x = [0; n];
|
||||
//~^ ERROR expected constant integer for repeat count, found variable
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,16 @@
|
|||
|
||||
// pretty-expanded FIXME #23616
|
||||
|
||||
#![feature(core)]
|
||||
|
||||
// Catch mistakes in the overflowing literals lint.
|
||||
#![deny(overflowing_literals)]
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!(0xffffffff, (-1 as u32));
|
||||
assert_eq!(4294967295, (-1 as u32));
|
||||
assert_eq!(0xffffffffffffffff, (-1 as u64));
|
||||
assert_eq!(18446744073709551615, (-1 as u64));
|
||||
|
||||
assert_eq!(-2147483648 - 1, 2147483647);
|
||||
assert_eq!((-2147483648).wrapping_sub(1), 2147483647);
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ static CLs: Es = Es::Ls;
|
|||
static CHs: Es = Es::Hs;
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!((Eu::Hu as u8) + 1, Eu::Lu as u8);
|
||||
assert_eq!((Es::Hs as i8) + 1, Es::Ls as i8);
|
||||
assert_eq!((Eu::Hu as u8).wrapping_add(1), Eu::Lu as u8);
|
||||
assert_eq!((Es::Hs as i8).wrapping_add(1), Es::Ls as i8);
|
||||
assert_eq!(CLu as u8, Eu::Lu as u8);
|
||||
assert_eq!(CHu as u8, Eu::Hu as u8);
|
||||
assert_eq!(CLs as i8, Es::Ls as i8);
|
||||
|
|
Loading…
Reference in a new issue