diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2024-03-06 21:59:03 +0000 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2024-03-06 21:59:03 +0000 |
| commit | 8e45d0fe495358bbb2415f1c0eec92d28b50c743 (patch) | |
| tree | 76c31e0a335154dec6d8a84ed5e3ef9bd19d2241 /compiler | |
| parent | bfe762e0ed2e95041cc12c02c5565c4368f2cc9f (diff) | |
| download | rust-8e45d0fe495358bbb2415f1c0eec92d28b50c743.tar.gz rust-8e45d0fe495358bbb2415f1c0eec92d28b50c743.zip | |
Cancel parsing ever made during recovery
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_parse/src/parser/stmt.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 54854cd2da9..ea9c78ca34c 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -787,13 +787,17 @@ impl<'a> Parser<'a> { let suggest_eq = if self.token.kind == token::Dot && let _ = self.bump() && let mut snapshot = self.create_snapshot_for_diagnostic() - && let Ok(_) = snapshot.parse_dot_suffix_expr( - colon_sp, - self.mk_expr_err( + && let Ok(_) = snapshot + .parse_dot_suffix_expr( colon_sp, - self.dcx().delayed_bug("error during `:` -> `=` recovery"), - ), - ) { + self.mk_expr_err( + colon_sp, + self.dcx() + .delayed_bug("error during `:` -> `=` recovery"), + ), + ) + .map_err(Diag::cancel) + { true } else if let Some(op) = self.check_assoc_op() && op.node.can_continue_expr_unambiguously() |
