-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
I-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied
Description
I just discovered another bug in the format args parser FormatArgsExpn::parse
while creating more tests for #9233.
Add this test case to the tests/ui/format_args.rs main()
to see it fail:
print!("error: something failed at {}", (Location::caller().to_string()));
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (does not include parens)
The resulting format_args.args[0].param.value
has a span does NOT include the surrounding parenthesis, which means that it suggest this:
Auto-fix is incorrectly suggesting this:
error: `to_string` applied to a type that implements `Display` in `print!` args
--> $DIR/format_args.rs:86:64
|
LL | print!("error: something failed at {}", (Location::caller().to_string()));
| ^^^^^^^^^^^^^ help: remove this
which results in an incompilabre
print!("error: something failed at {}", (Location::caller()); // <-- missing closing parenthesis
cc: @Alexendoo
Metadata
Metadata
Assignees
Labels
I-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied