Skip to content

Commit

Permalink
Unrolled build for rust-lang#124832
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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
  • Loading branch information
rust-timer authored May 7, 2024
2 parents 0f40f14 + f9bb5df commit eaaef4b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_parse/src/lexer/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand All @@ -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,
Expand All @@ -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
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/lexer/unicode_chars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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", " "),
Expand Down

0 comments on commit eaaef4b

Please sign in to comment.