narrow down visibilities in rustc_parse::lexer

This commit is contained in:
Lin Yihai 2024-05-07 11:02:28 +08:00
parent 5ae5d13537
commit f9bb5df5a0
3 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@
use rustc_span::Span; use rustc_span::Span;
#[derive(Default)] #[derive(Default)]
pub struct TokenTreeDiagInfo { pub(super) struct TokenTreeDiagInfo {
/// Stack of open delimiters and their spans. Used for error message. /// Stack of open delimiters and their spans. Used for error message.
pub open_braces: Vec<(Delimiter, Span)>, pub open_braces: Vec<(Delimiter, Span)>,
pub unmatched_delims: Vec<UnmatchedDelim>, pub unmatched_delims: Vec<UnmatchedDelim>,
@ -21,7 +21,7 @@ pub struct TokenTreeDiagInfo {
pub matching_block_spans: Vec<(Span, Span)>, pub matching_block_spans: Vec<(Span, Span)>,
} }
pub fn same_indentation_level(sm: &SourceMap, open_sp: Span, close_sp: Span) -> bool { pub(super) fn same_indentation_level(sm: &SourceMap, open_sp: Span, close_sp: Span) -> bool {
match (sm.span_to_margin(open_sp), sm.span_to_margin(close_sp)) { match (sm.span_to_margin(open_sp), sm.span_to_margin(close_sp)) {
(Some(open_padding), Some(close_padding)) => open_padding == close_padding, (Some(open_padding), Some(close_padding)) => open_padding == close_padding,
_ => false, _ => false,
@ -30,7 +30,7 @@ pub fn same_indentation_level(sm: &SourceMap, open_sp: Span, close_sp: Span) ->
// When we get a `)` or `]` for `{`, we should emit help message here // When we get a `)` or `]` for `{`, we should emit help message here
// it's more friendly compared to report `unmatched error` in later phase // it's more friendly compared to report `unmatched error` in later phase
pub fn report_missing_open_delim(err: &mut Diag<'_>, unmatched_delims: &[UnmatchedDelim]) -> bool { fn report_missing_open_delim(err: &mut Diag<'_>, unmatched_delims: &[UnmatchedDelim]) -> bool {
let mut reported_missing_open = false; let mut reported_missing_open = false;
for unmatch_brace in unmatched_delims.iter() { for unmatch_brace in unmatched_delims.iter() {
if let Some(delim) = unmatch_brace.found_delim if let Some(delim) = unmatch_brace.found_delim
@ -51,7 +51,7 @@ pub fn report_missing_open_delim(err: &mut Diag<'_>, unmatched_delims: &[Unmatch
reported_missing_open reported_missing_open
} }
pub fn report_suspicious_mismatch_block( pub(super) fn report_suspicious_mismatch_block(
err: &mut Diag<'_>, err: &mut Diag<'_>,
diag_info: &TokenTreeDiagInfo, diag_info: &TokenTreeDiagInfo,
sm: &SourceMap, sm: &SourceMap,

View File

@ -112,7 +112,7 @@ struct StringReader<'psess, 'src> {
} }
impl<'psess, 'src> StringReader<'psess, 'src> { impl<'psess, 'src> StringReader<'psess, 'src> {
pub fn dcx(&self) -> &'psess DiagCtxt { fn dcx(&self) -> &'psess DiagCtxt {
&self.psess.dcx &self.psess.dcx
} }

View File

@ -9,7 +9,7 @@
use rustc_span::{symbol::kw, BytePos, Pos, Span}; use rustc_span::{symbol::kw, BytePos, Pos, Span};
#[rustfmt::skip] // for line breaks #[rustfmt::skip] // for line breaks
pub(crate) const UNICODE_ARRAY: &[(char, &str, &str)] = &[ pub(super) const UNICODE_ARRAY: &[(char, &str, &str)] = &[
('', "Line Separator", " "), ('', "Line Separator", " "),
('', "Paragraph Separator", " "), ('', "Paragraph Separator", " "),
('', "Ogham Space mark", " "), ('', "Ogham Space mark", " "),