Rollup merge of #123632 - ohno418:fix-UnmatchedDelim-visibility, r=compiler-errors

parser: reduce visibility of unnecessary public `UnmatchedDelim`

`lexer::UnmatchedDelim` struct in `rustc_parse` is unnecessary public outside of the crate. This commit reduces the visibility to `pub(crate)`.

Beside, this removes unnecessary field `expected_delim` that causes warnings after changing the visibility.
This commit is contained in:
Matthias Krüger 2024-04-08 22:06:24 +02:00 committed by GitHub
commit c0ac5d84a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 5 deletions

View File

@ -34,8 +34,7 @@
rustc_data_structures::static_assert_size!(rustc_lexer::Token, 12); rustc_data_structures::static_assert_size!(rustc_lexer::Token, 12);
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct UnmatchedDelim { pub(crate) struct UnmatchedDelim {
pub expected_delim: Delimiter,
pub found_delim: Option<Delimiter>, pub found_delim: Option<Delimiter>,
pub found_span: Span, pub found_span: Span,
pub unclosed_span: Option<Span>, pub unclosed_span: Option<Span>,

View File

@ -77,7 +77,6 @@ fn eof_err(&mut self) -> PErr<'psess> {
for &(_, sp) in &self.diag_info.open_braces { for &(_, sp) in &self.diag_info.open_braces {
err.span_label(sp, "unclosed delimiter"); err.span_label(sp, "unclosed delimiter");
self.diag_info.unmatched_delims.push(UnmatchedDelim { self.diag_info.unmatched_delims.push(UnmatchedDelim {
expected_delim: Delimiter::Brace,
found_delim: None, found_delim: None,
found_span: self.token.span, found_span: self.token.span,
unclosed_span: Some(sp), unclosed_span: Some(sp),
@ -163,9 +162,8 @@ fn parse_token_tree_open_delim(
candidate = Some(*brace_span); candidate = Some(*brace_span);
} }
} }
let (tok, _) = self.diag_info.open_braces.pop().unwrap(); let (_, _) = self.diag_info.open_braces.pop().unwrap();
self.diag_info.unmatched_delims.push(UnmatchedDelim { self.diag_info.unmatched_delims.push(UnmatchedDelim {
expected_delim: tok,
found_delim: Some(close_delim), found_delim: Some(close_delim),
found_span: self.token.span, found_span: self.token.span,
unclosed_span: unclosed_delimiter, unclosed_span: unclosed_delimiter,