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:
parent
75fd074338
commit
3a0d8d8afc
@ -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>,
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user