Closed
Description
Michale Gattozzi identified this on twitter with a compelling sample:
fn main() {
let mut _x: isize;
let mut _y = (_x = 2) == (_x = 2);
println!("{}", _x = 5);
println!("{}", _x);
}
This prints
5
2
Which is potentially surprising, since it's not immediately obvious that the _x
in the println
macro is acting like a named argument.
It would be useful to emit either a warning or an error so that named arguments that are used only based on position are identified to avoid causing confusion, since to a reader it looks like an assignment.
Metadata
Metadata
Assignees
Labels
No labels