Closed
Description
I would not expect this code to produce a warning:
fn main() {
let a: i8 = 0x20;
assert!(a == 0xff);
}
Although the following warnings are printed
foo.rs:3:12: 3:21 warning: comparison is useless due to type limits, #[warn(type_limits)] on by default
foo.rs:3 assert!(a == 0xff);
^~~~~~~~~
<std-macros>:36:4: 52:5 note: in expansion of assert!
foo.rs:3:4: 3:23 note: expansion site
foo.rs:3:17: 3:21 warning: literal out of range for its type, #[warn(type_overflow)] on by default
foo.rs:3 assert!(a == 0xff);
^~~~
<std-macros>:36:4: 52:5 note: in expansion of assert!
foo.rs:3:4: 3:23 note: expansion site
Metadata
Metadata
Assignees
Labels
No labels