diff options
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index d7c209d12a8..6a881eb6241 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2869,11 +2869,18 @@ impl<'a> Parser<'a> { self.eat_to_tokens(&[&token::OpenDelim(token::Paren)]); let span = lo.until(self.span); + // We needn't check `encountered_gt` to determine if we should pluralize "bracket". + // `encountered_gt` can only represent a single `>` character, if `number_of_shr >= 1` + // then there is either `>>` or `>>>` - in either case a plural is warranted. + let plural = number_of_shr >= 1; self.diagnostic() - .struct_span_err(span, "unmatched angle bracket") + .struct_span_err( + span, + &format!("unmatched angle bracket{}", if plural { "s" } else { "" }), + ) .span_suggestion_with_applicability( span, - "remove extra angle bracket", + &format!("remove extra angle bracket{}", if plural { "s" } else { "" }), String::new(), Applicability::MachineApplicable, ) |
