Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

narrow down visibilities in rustc_parse::lexer #124832

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading