Issue
While using MIRAI to analyze a Rust project, I found that it fails to generate a division-by-zero warning for the isize type, whereas the u64 type correctly triggers such a warning.
Steps to Reproduce
The minimized test case with isize:
fn test(x: isize, y: isize) -> isize {
x / y
}
fn main() {
test(1, 0);
}
The minimized test case with u64:
fn test(x: u64, y: u64) -> u64 {
x / y
}
fn main() {
test(1, 0);
}
Then run cargo mirai in both test cases.
Expected Behavior
MIRAI should generate warning for both test case, as both case will panic with divided bu zero.
Actual Results
MIRAI only generates division zero warning in the second case.
warning: [MIRAI] attempt to divide by zero
--> src/main.rs:5:5
|
5 | test(1, 0);
| ^^^^^^^^^^
|
note: related location
--> src/main.rs:2:5
|
2 | x / y
| ^^^^^
warning: `div_u64` (bin "div_u64") generated 1 warning
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.44s
Environment
Rust version (rustc --version)
rustc 1.86.0-nightly (824759493 2025-01-09)
Issue
While using MIRAI to analyze a Rust project, I found that it fails to generate a division-by-zero warning for the
isizetype, whereas theu64type correctly triggers such a warning.Steps to Reproduce
The minimized test case with
isize:The minimized test case with
u64:Then run cargo mirai in both test cases.
Expected Behavior
MIRAI should generate warning for both test case, as both case will panic with divided bu zero.
Actual Results
MIRAI only generates division zero warning in the second case.
Environment
Rust version (rustc --version)
rustc 1.86.0-nightly (824759493 2025-01-09)