Closed
Description
Given the following code:
1.63.0-nightly (2022-05-22)
struct A {
config: String,
}
impl A {
fn do_something(self, cofig: String) {
println!("{config}"); //~ Error cannot find value `config` in this scope
}
}
fn main() {}
The current output is:
This suggestion can cause compiler errors.
Compiling playground v0.0.1 (/playground)
error[[E0425]](https://doc.rust-lang.org/nightly/error-index.html#E0425): cannot find value `config` in this scope
--> src/main.rs:7:20
|
7 | println!("{config}"); //~ Error cannot find value `config` in this scope
| ^^^^^^ help: you might have meant to use the available field: `self.config`
For more information about this error, try `rustc --explain E0425`.
error: could not compile `playground` due to previous error
Ideally the output should look like:
help
shouldn't be emitted.
or should look like println!("{}", self.config)
.
Compiling playground v0.0.1 (/playground)
error[[E0425]](https://doc.rust-lang.org/nightly/error-index.html#E0425): cannot find value `config` in this scope
--> src/main.rs:7:20
|
7 | println!("{config}"); //~ Error cannot find value `config` in this scope
| ^^^^^^
For more information about this error, try `rustc --explain E0425`.
error: could not compile `playground` due to previous error