Rollup merge of #122115 - clubby789:cancel-recoverr, r=compiler-errors
Cancel parsing ever made during recovery Fixes #122112 It would be nice if diagnostics from recovery were automatically cancelled... 🤔
This commit is contained in:
commit
9bda4e47c7
@ -787,13 +787,17 @@ impl<'a> Parser<'a> {
|
|||||||
let suggest_eq = if self.token.kind == token::Dot
|
let suggest_eq = if self.token.kind == token::Dot
|
||||||
&& let _ = self.bump()
|
&& let _ = self.bump()
|
||||||
&& let mut snapshot = self.create_snapshot_for_diagnostic()
|
&& let mut snapshot = self.create_snapshot_for_diagnostic()
|
||||||
&& let Ok(_) = snapshot.parse_dot_suffix_expr(
|
&& let Ok(_) = snapshot
|
||||||
colon_sp,
|
.parse_dot_suffix_expr(
|
||||||
self.mk_expr_err(
|
|
||||||
colon_sp,
|
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
|
true
|
||||||
} else if let Some(op) = self.check_assoc_op()
|
} else if let Some(op) = self.check_assoc_op()
|
||||||
&& op.node.can_continue_expr_unambiguously()
|
&& op.node.can_continue_expr_unambiguously()
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
#![allow(unused)]
|
||||||
|
|
||||||
|
fn test_122112() {
|
||||||
|
// Make sure we don't ICE if parsing in recovery fails
|
||||||
|
let _: std::env::temp_dir().join(&self, push: Box<usize>); //~ ERROR expected one of
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _: std::env::temp_dir().join("foo"); //~ ERROR expected one of
|
let _: std::env::temp_dir().join("foo"); //~ ERROR expected one of
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.`
|
error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.`
|
||||||
--> $DIR/recover-colon-instead-of-eq-in-local.rs:2:32
|
--> $DIR/recover-colon-instead-of-eq-in-local.rs:5:32
|
||||||
|
|
|
||||||
|
LL | let _: std::env::temp_dir().join(&self, push: Box<usize>);
|
||||||
|
| - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
|
||||||
|
| |
|
||||||
|
| while parsing the type for `_`
|
||||||
|
|
||||||
|
error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.`
|
||||||
|
--> $DIR/recover-colon-instead-of-eq-in-local.rs:9:32
|
||||||
|
|
|
|
||||||
LL | let _: std::env::temp_dir().join("foo");
|
LL | let _: std::env::temp_dir().join("foo");
|
||||||
| - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
|
| - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
|
||||||
@ -7,5 +15,5 @@ LL | let _: std::env::temp_dir().join("foo");
|
|||||||
| while parsing the type for `_`
|
| while parsing the type for `_`
|
||||||
| help: use `=` if you meant to assign
|
| help: use `=` if you meant to assign
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user