Rollup merge of #108297 - chenyukang:yukang/delim-error-exit, r=petrochenkov

Exit when there are unmatched delims to avoid noisy diagnostics

From https://github.com/rust-lang/rust/pull/104012#issuecomment-1311764832
r? ``@petrochenkov``
This commit is contained in:
Matthias Krüger
2023-03-01 01:20:22 +01:00
committed by GitHub
106 changed files with 325 additions and 1586 deletions

View File

@@ -19,7 +19,7 @@ use crate::errors::{
};
use crate::fluent_generated as fluent;
use crate::lexer::UnmatchedBrace;
use crate::lexer::UnmatchedDelim;
use crate::parser;
use rustc_ast as ast;
use rustc_ast::ptr::P;
@@ -222,7 +222,7 @@ impl MultiSugg {
/// is dropped.
pub struct SnapshotParser<'a> {
parser: Parser<'a>,
unclosed_delims: Vec<UnmatchedBrace>,
unclosed_delims: Vec<UnmatchedDelim>,
}
impl<'a> Deref for SnapshotParser<'a> {
@@ -264,7 +264,7 @@ impl<'a> Parser<'a> {
self.unclosed_delims.extend(snapshot.unclosed_delims);
}
pub fn unclosed_delims(&self) -> &[UnmatchedBrace] {
pub fn unclosed_delims(&self) -> &[UnmatchedDelim] {
&self.unclosed_delims
}