Suggest changing _x
to x
instead of a use of x
to _x
#60164
Closed
Description
Variables can be marked as unused by prepending with an underscore. If at some point such a variable is used again, the compiler suggests to name the use _x
, even though every single time I have encountered this, what I wanted is to change the definition of _x
to x
.
fn main() {
let _x = 42;
let y = x;
}
Errors:
Compiling playground v0.0.1 (/playground)
error[E0465]: multiple rlib candidates for `debug_unreachable` found
|
= note: candidate #1: /playground/target/debug/deps/libdebug_unreachable-aa3385f4476cae47.rlib
= note: candidate #2: /playground/target/debug/deps/libdebug_unreachable-661505f3db863158.rlib
error[E0425]: cannot find value `x` in this scope
--> src/main.rs:3:13
|
3 | let y = x;
| ^ help: a local variable with a similar name exists: `_x`
error: aborting due to 2 previous errors
Some errors occurred: E0425, E0465.
For more information about an error, try `rustc --explain E0425`.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.