diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-05-07 18:12:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-07 18:12:55 +0200 |
| commit | fdeac24c52d93fa0e1ecedef35194ee4990edf68 (patch) | |
| tree | 76c08f4e35c2df7ec16909d7e97a61f50afa7fa7 /compiler/rustc_parse/src | |
| parent | 4a5bf7b06e5ae37883669d018050b552363af00d (diff) | |
| parent | f9bb5df5a0655190ed4f0d33cebbe6116c3f2eb1 (diff) | |
| download | rust-fdeac24c52d93fa0e1ecedef35194ee4990edf68.tar.gz rust-fdeac24c52d93fa0e1ecedef35194ee4990edf68.zip | |
Rollup merge of #124832 - linyihai:visibility-of-lexer, r=fmease
narrow down visibilities in `rustc_parse::lexer` Found something visibility can be narrowed down on `rustc_parse::lexer`. The mods only used in lexer, so it is ok to limit visibility to `pub(super)`, see https://github.com/rust-lang/rust/blob/master/compiler/rustc_parse/src/lexer/mod.rs#L22-L25
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/lexer/diagnostics.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/lexer/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/lexer/unicode_chars.rs | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/lexer/diagnostics.rs b/compiler/rustc_parse/src/lexer/diagnostics.rs index 993ff1b97f5..1247e2e44fb 100644 --- a/compiler/rustc_parse/src/lexer/diagnostics.rs +++ b/compiler/rustc_parse/src/lexer/diagnostics.rs @@ -5,7 +5,7 @@ use rustc_span::source_map::SourceMap; use rustc_span::Span; #[derive(Default)] -pub struct TokenTreeDiagInfo { +pub(super) struct TokenTreeDiagInfo { /// Stack of open delimiters and their spans. Used for error message. pub open_braces: Vec<(Delimiter, Span)>, pub unmatched_delims: Vec<UnmatchedDelim>, @@ -21,7 +21,7 @@ pub struct TokenTreeDiagInfo { 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)) { (Some(open_padding), Some(close_padding)) => open_padding == close_padding, _ => 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 // 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; for unmatch_brace in unmatched_delims.iter() { 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 } -pub fn report_suspicious_mismatch_block( +pub(super) fn report_suspicious_mismatch_block( err: &mut Diag<'_>, diag_info: &TokenTreeDiagInfo, sm: &SourceMap, diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index 1abb1d29562..d2d200a91af 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -112,7 +112,7 @@ struct StringReader<'psess, 'src> { } impl<'psess, 'src> StringReader<'psess, 'src> { - pub fn dcx(&self) -> &'psess DiagCtxt { + fn dcx(&self) -> &'psess DiagCtxt { &self.psess.dcx } diff --git a/compiler/rustc_parse/src/lexer/unicode_chars.rs b/compiler/rustc_parse/src/lexer/unicode_chars.rs index 6b055fc844a..c9470151a7b 100644 --- a/compiler/rustc_parse/src/lexer/unicode_chars.rs +++ b/compiler/rustc_parse/src/lexer/unicode_chars.rs @@ -9,7 +9,7 @@ use crate::{ use rustc_span::{symbol::kw, BytePos, Pos, Span}; #[rustfmt::skip] // for line breaks -pub(crate) const UNICODE_ARRAY: &[(char, &str, &str)] = &[ +pub(super) const UNICODE_ARRAY: &[(char, &str, &str)] = &[ (' ', "Line Separator", " "), (' ', "Paragraph Separator", " "), (' ', "Ogham Space mark", " "), |
