diff options
| author | Michael Goulet <michael@errs.io> | 2022-02-02 10:33:13 -0800 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-02-02 10:33:13 -0800 |
| commit | b79fc92db3f0264136c3bc3c70b80e8b7b443fc3 (patch) | |
| tree | 8a8f83a374f2597e6725017cbeb40d9cd9ab6d31 /compiler/rustc_parse/src | |
| parent | d5f9c40e6a9ecc62432e71e886cef83a4c2c9b98 (diff) | |
| download | rust-b79fc92db3f0264136c3bc3c70b80e8b7b443fc3.tar.gz rust-b79fc92db3f0264136c3bc3c70b80e8b7b443fc3.zip | |
fix ICE when parsing lifetime as function argument
Diffstat (limited to 'compiler/rustc_parse/src')
| -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 0115d498a7f..0a9452a83a5 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 { |
