Don't include bang in macro replacement suggestion
When we suggest the replacement for a macro we include the "!" in the suggested replacement but the span only contains the name of the macro itself. Using that replacement would cause a duplicate "!" in the resulting code. I originally tried to extend the span to be replaced by 1 byte in rust-lang/rust#47424. However, @zackmdavis pointed out that there can be whitespace between the macro name and the bang. Instead, just remove the bang from the suggested replacement. Fixes #47418
This commit is contained in:
parent
bb345a0be3
commit
ecd47a91c7
4 changed files with 6 additions and 7 deletions
|
|
@ -691,8 +691,7 @@ impl<'a> Resolver<'a> {
|
|||
if let Some(suggestion) = suggestion {
|
||||
if suggestion != name {
|
||||
if let MacroKind::Bang = kind {
|
||||
err.span_suggestion(span, "you could try the macro",
|
||||
format!("{}!", suggestion));
|
||||
err.span_suggestion(span, "you could try the macro", suggestion.to_string());
|
||||
} else {
|
||||
err.span_suggestion(span, "try", suggestion.to_string());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue