Add println! test for sugg-field-in-format-string-issue-141136
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
parent
9de7fff0d8
commit
4ec991989a
2 changed files with 10 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ impl Foo {
|
|||
let _ = format!("{x }"); //~ ERROR cannot find value `x` in this scope [E0425]
|
||||
let _ = format!("{ x}"); //~ ERROR invalid format string: expected `}`, found `x`
|
||||
let _ = format!("{}", x); //~ ERROR cannot find value `x` in this scope [E0425]
|
||||
println!("{x}"); //~ ERROR cannot find value `x` in this scope [E0425]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,14 @@ help: you might have meant to use the available field
|
|||
LL | let _ = format!("{}", self.x);
|
||||
| +++++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/sugg-field-in-format-string-issue-141136.rs:11:20
|
||||
|
|
||||
LL | println!("{x}");
|
||||
| ^
|
||||
|
|
||||
= help: you might have meant to use the available field in a format string: `"{}", self.x`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue