rust/tests/ui/lint/deny-overflowing-literals.rs

8 lines
163 B
Rust
Raw Normal View History

2018-09-23 09:59:06 -05:00
fn main() {
let x: u8 = 256;
2019-04-27 06:56:57 -05:00
//~^ error: literal out of range for `u8`
for _ in 0..256u8 {}
//~^ error: range endpoint is out of range for `u8`
2018-09-23 09:59:06 -05:00
}