Closed
Description
Consider the following code:
fn g(x: u8) -> u8 {
1 - x
}
fn main() {
let mut x = 1u8;
macro_rules! m {
() => {{
x = g(x);
if x == 0 {
x = 1;
}
}}
}
m!();
g(1/x);
m!();
}
test.rs:252:17: 252:18 warning: value assigned to `x` is never read, #[warn(dead_assignment)] on by default
test.rs:252 x = 1;
^
test.rs:248:5: 257:6 note: in expansion of m!
test.rs:259:5: 259:10 note: expansion site
And after removing the dead assignment:
task '<main>' failed at 'attempted to divide by zero', test.rs:257