]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_parse/src/parser/stmt.rs
Improves parser diagnostics, fixes #93867
[rust.git] / compiler / rustc_parse / src / parser / stmt.rs
index ac693597662e6e55c27ca68c7fbabcfa5cd958bf..f18f7222b7ab62c2b7c16fec29dd8e2738dd2a38 100644 (file)
@@ -262,7 +262,10 @@ fn parse_local(&mut self, attrs: AttrVec) -> PResult<'a, P<Local>> {
                     if let Ok(snip) = self.span_to_snippet(pat.span) {
                         err.span_label(pat.span, format!("while parsing the type for `{}`", snip));
                     }
-                    let err = if self.check(&token::Eq) {
+                    // we use noexpect here because we don't actually expect Eq to be here
+                    // but we are still checking for it in order to be able to handle it if
+                    // it is there
+                    let err = if self.check_noexpect(&token::Eq) {
                         err.emit();
                         None
                     } else {