diff options
| author | Michael Goulet <michael@errs.io> | 2025-06-26 18:08:15 +0000 | 
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-06-26 18:11:14 +0000 | 
| commit | 4e51e67a24d940d3c8069062d07f663ee2034ac3 (patch) | |
| tree | 7eae19234f8476ea8fcc54e7f3308e3aa31e745e /compiler/rustc_parse/src/parser/generics.rs | |
| parent | e63921262ccd2ece7e0861d634f111136da1f7da (diff) | |
| download | rust-4e51e67a24d940d3c8069062d07f663ee2034ac3.tar.gz rust-4e51e67a24d940d3c8069062d07f663ee2034ac3.zip | |
Better recovery
Diffstat (limited to 'compiler/rustc_parse/src/parser/generics.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/generics.rs | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index c05479feb61..af1d1a1ec66 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -353,6 +353,20 @@ impl<'a> Parser<'a> { if !self.eat_keyword(exp!(Where)) { return Ok((where_clause, None)); } + + if self.eat_noexpect(&token::Colon) { + let colon_span = self.prev_token.span; + self.dcx() + .struct_span_err(colon_span, "unexpected colon after `where`") + .with_span_suggestion_short( + colon_span, + "remove the colon", + "", + Applicability::MachineApplicable, + ) + .emit(); + } + where_clause.has_where_token = true; let where_lo = self.prev_token.span; | 
