diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-02-12 09:26:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-12 09:26:21 +0100 |
| commit | 602898a305eb695d48e8f2bee65bb42d6dabf3b3 (patch) | |
| tree | 78df8b42d891f4006bcee21f7e215191ac54261c /compiler/rustc_parse | |
| parent | 661be4c782413576aae48fc4267b91bb1ad39fa0 (diff) | |
| parent | 5be9e79ae02d9e61542f12c18c1da70aa1d2d5ff (diff) | |
| download | rust-602898a305eb695d48e8f2bee65bb42d6dabf3b3.tar.gz rust-602898a305eb695d48e8f2bee65bb42d6dabf3b3.zip | |
Rollup merge of #93595 - compiler-errors:ice-on-lifetime-arg, r=jackh726
fix ICE when parsing lifetime as function argument I don't really like this, but we basically need to emit an error instead of just delaying an bug, because there are too many places in the AST that aren't covered by my previous PRs... cc: https://github.com/rust-lang/rust/issues/93282#issuecomment-1028052945
Diffstat (limited to 'compiler/rustc_parse')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 4898a4844b9..e9aa4adcaf7 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1457,9 +1457,9 @@ impl<'a> Parser<'a> { } else if self.check(&token::OpenDelim(token::Brace)) || self.token.is_whole_block() { self.parse_block_expr(label, lo, BlockCheckMode::Default, attrs) } else if !ate_colon && (self.check(&TokenKind::Comma) || self.check(&TokenKind::Gt)) { - // We're probably inside of a `Path<'a>` that needs a turbofish, so suppress the - // "must be followed by a colon" error, and the "expected one of" error. - self.diagnostic().delay_span_bug(lo, "this label wasn't parsed correctly"); + // We're probably inside of a `Path<'a>` that needs a turbofish + let msg = "expected `while`, `for`, `loop` or `{` after a label"; + self.struct_span_err(self.token.span, msg).span_label(self.token.span, msg).emit(); consume_colon = false; Ok(self.mk_expr_err(lo)) } else { |
