Skip to content

Commit 4ec9919

Browse files
committed
Add println! test for sugg-field-in-format-string-issue-141136
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
1 parent 9de7fff commit 4ec9919

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

tests/ui/resolve/suggestions/sugg-field-in-format-string-issue-141136.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ impl Foo {
88
let _ = format!("{x }"); //~ ERROR cannot find value `x` in this scope [E0425]
99
let _ = format!("{ x}"); //~ ERROR invalid format string: expected `}`, found `x`
1010
let _ = format!("{}", x); //~ ERROR cannot find value `x` in this scope [E0425]
11+
println!("{x}"); //~ ERROR cannot find value `x` in this scope [E0425]
1112
}
1213
}
1314

tests/ui/resolve/suggestions/sugg-field-in-format-string-issue-141136.stderr

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ help: you might have meant to use the available field
3535
LL | let _ = format!("{}", self.x);
3636
| +++++
3737

38-
error: aborting due to 4 previous errors
38+
error[E0425]: cannot find value `x` in this scope
39+
--> $DIR/sugg-field-in-format-string-issue-141136.rs:11:20
40+
|
41+
LL | println!("{x}");
42+
| ^
43+
|
44+
= help: you might have meant to use the available field in a format string: `"{}", self.x`
45+
46+
error: aborting due to 5 previous errors
3947

4048
For more information about this error, try `rustc --explain E0425`.

0 commit comments

Comments
 (0)