rust/tests/ui/resolve/suggestions/sugg-field-in-format-string-issue-141136.stderr
xizheyin 9de7fff0d8
Suggest use "{}", self.x instead of {self.x} when resolve x as field of self
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-18 16:14:48 +08:00

41 lines
1.4 KiB
Plaintext

error: invalid format string: expected `}`, found `x`
--> $DIR/sugg-field-in-format-string-issue-141136.rs:9:28
|
LL | let _ = format!("{ x}");
| - ^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error[E0425]: cannot find value `x` in this scope
--> $DIR/sugg-field-in-format-string-issue-141136.rs:7:27
|
LL | let _ = format!("{x}");
| ^
|
= help: you might have meant to use the available field in a format string: `"{}", self.x`
error[E0425]: cannot find value `x` in this scope
--> $DIR/sugg-field-in-format-string-issue-141136.rs:8:27
|
LL | let _ = format!("{x }");
| ^^
|
= help: you might have meant to use the available field in a format string: `"{}", self.x`
error[E0425]: cannot find value `x` in this scope
--> $DIR/sugg-field-in-format-string-issue-141136.rs:10:31
|
LL | let _ = format!("{}", x);
| ^
|
help: you might have meant to use the available field
|
LL | let _ = format!("{}", self.x);
| +++++
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0425`.