mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Use integer assoc consts in libcore
This commit is contained in:
parent
e4fc04b6df
commit
3e4396b8b5
@ -1108,14 +1108,14 @@ mod slice_index {
|
||||
|
||||
// note: using 0 specifically ensures that the result of overflowing is 0..0,
|
||||
// so that `get` doesn't simply return None for the wrong reason.
|
||||
bad: data[0 ..= ::std::usize::MAX];
|
||||
bad: data[0 ..= usize::MAX];
|
||||
message: "maximum usize";
|
||||
}
|
||||
|
||||
in mod rangetoinclusive_overflow {
|
||||
data: [0, 1];
|
||||
|
||||
bad: data[..= ::std::usize::MAX];
|
||||
bad: data[..= usize::MAX];
|
||||
message: "maximum usize";
|
||||
}
|
||||
} // panic_cases!
|
||||
|
@ -14,7 +14,7 @@ fn creation() {
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn new_overflow() {
|
||||
let _ = Duration::new(::core::u64::MAX, 1_000_000_000);
|
||||
let _ = Duration::new(u64::MAX, 1_000_000_000);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -86,7 +86,7 @@ fn checked_add() {
|
||||
Duration::new(0, 500_000_000).checked_add(Duration::new(0, 500_000_001)),
|
||||
Some(Duration::new(1, 1))
|
||||
);
|
||||
assert_eq!(Duration::new(1, 0).checked_add(Duration::new(::core::u64::MAX, 0)), None);
|
||||
assert_eq!(Duration::new(1, 0).checked_add(Duration::new(u64::MAX, 0)), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -133,7 +133,7 @@ fn checked_mul() {
|
||||
assert_eq!(Duration::new(1, 1).checked_mul(3), Some(Duration::new(3, 3)));
|
||||
assert_eq!(Duration::new(0, 500_000_001).checked_mul(4), Some(Duration::new(2, 4)));
|
||||
assert_eq!(Duration::new(0, 500_000_001).checked_mul(4000), Some(Duration::new(2000, 4000)));
|
||||
assert_eq!(Duration::new(::core::u64::MAX - 1, 0).checked_mul(2), None);
|
||||
assert_eq!(Duration::new(u64::MAX - 1, 0).checked_mul(2), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user