revert to previous span
This commit is contained in:
parent
655beb4ece
commit
4447949e40
7 changed files with 10 additions and 9 deletions
|
@ -352,11 +352,12 @@ impl<'a> Parser<'a> {
|
|||
// if there is a `<` after the fn name, then don't show a suggestion, show help
|
||||
|
||||
if !self.look_ahead(1, |t| *t == token::Lt) &&
|
||||
let Ok(snippet) = self.sess.source_map().span_to_snippet(generic.span) {
|
||||
let Ok(snippet) = self.sess.source_map().span_to_snippet(generic.span) &&
|
||||
let Ok(ident) = self.sess.source_map().span_to_snippet(self.token.span) {
|
||||
err.span_suggestion_verbose(
|
||||
self.token.span.shrink_to_hi(),
|
||||
generic.span.to(self.token.span),
|
||||
format!("place the generic parameter name after the {ident_name} name"),
|
||||
snippet,
|
||||
format!(" {ident}{snippet}"),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue