rustc_parse: migrate more to diagnostic structs

This commit is contained in:
Xiretza 2022-10-14 23:16:25 +02:00
parent ac9c66bff5
commit 87ef37dbd7
9 changed files with 974 additions and 488 deletions

View file

@ -1,7 +1,7 @@
use super::attr::InnerAttrForbiddenReason;
use super::diagnostics::AttemptLocalParseRecovery;
use super::expr::LhsExpr;
use super::pat::RecoverComma;
use super::pat::{PatternLocation, RecoverComma};
use super::path::PathStyle;
use super::TrailingToken;
use super::{
@ -275,7 +275,8 @@ impl<'a> Parser<'a> {
}
self.report_invalid_identifier_error()?;
let (pat, colon) = self.parse_pat_before_ty(None, RecoverComma::Yes, "`let` bindings")?;
let (pat, colon) =
self.parse_pat_before_ty(None, RecoverComma::Yes, PatternLocation::LetBinding)?;
let (err, ty) = if colon {
// Save the state of the parser before parsing type normally, in case there is a `:`