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

Reduce pub exposure in rustc_mir_build #125959

Merged
merged 2 commits into from
Jun 4, 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_mir_build/src/build/coverageinfo/mcdc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,18 @@ impl MCDCState {
}
}

pub struct MCDCInfoBuilder {
pub(crate) struct MCDCInfoBuilder {
branch_spans: Vec<MCDCBranchSpan>,
decision_spans: Vec<MCDCDecisionSpan>,
state: MCDCState,
}

impl MCDCInfoBuilder {
pub fn new() -> Self {
pub(crate) fn new() -> Self {
Self { branch_spans: vec![], decision_spans: vec![], state: MCDCState::new() }
}

pub fn visit_evaluated_condition(
pub(crate) fn visit_evaluated_condition(
&mut self,
tcx: TyCtxt<'_>,
source_info: SourceInfo,
Expand Down Expand Up @@ -243,7 +243,7 @@ impl MCDCInfoBuilder {
});
}

pub fn into_done(self) -> (Vec<MCDCDecisionSpan>, Vec<MCDCBranchSpan>) {
pub(crate) fn into_done(self) -> (Vec<MCDCDecisionSpan>, Vec<MCDCBranchSpan>) {
(self.decision_spans, self.branch_spans)
}
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_build/src/build/custom/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
}
}

pub fn parse_args(&mut self, params: &IndexSlice<ParamId, Param<'tcx>>) -> PResult<()> {
pub(crate) fn parse_args(&mut self, params: &IndexSlice<ParamId, Param<'tcx>>) -> PResult<()> {
for param in params.iter() {
let (var, span) = {
let pat = param.pat.as_ref().unwrap();
Expand Down Expand Up @@ -149,7 +149,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
///
/// This allows us to easily parse the basic blocks declarations, local declarations, and
/// basic block definitions in order.
pub fn parse_body(&mut self, expr_id: ExprId) -> PResult<()> {
pub(crate) fn parse_body(&mut self, expr_id: ExprId) -> PResult<()> {
let body = parse_by_kind!(self, expr_id, _, "whole body",
ExprKind::Block { block } => self.thir[*block].expr.unwrap(),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::build::expr::as_constant::as_constant_inner;
use super::{parse_by_kind, PResult, ParseCtxt};

impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
pub fn parse_statement(&self, expr_id: ExprId) -> PResult<StatementKind<'tcx>> {
pub(crate) fn parse_statement(&self, expr_id: ExprId) -> PResult<StatementKind<'tcx>> {
parse_by_kind!(self, expr_id, _, "statement",
@call(mir_storage_live, args) => {
Ok(StatementKind::StorageLive(self.parse_local(args[0])?))
Expand Down Expand Up @@ -46,7 +46,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
)
}

pub fn parse_terminator(&self, expr_id: ExprId) -> PResult<TerminatorKind<'tcx>> {
pub(crate) fn parse_terminator(&self, expr_id: ExprId) -> PResult<TerminatorKind<'tcx>> {
parse_by_kind!(self, expr_id, expr, "terminator",
@call(mir_return, _args) => {
Ok(TerminatorKind::Return)
Expand Down Expand Up @@ -261,7 +261,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
)
}

pub fn parse_operand(&self, expr_id: ExprId) -> PResult<Operand<'tcx>> {
pub(crate) fn parse_operand(&self, expr_id: ExprId) -> PResult<Operand<'tcx>> {
parse_by_kind!(self, expr_id, expr, "operand",
@call(mir_move, args) => self.parse_place(args[0]).map(Operand::Move),
@call(mir_static, args) => self.parse_static(args[0]),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/expr/as_constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
}

pub fn as_constant_inner<'tcx>(
pub(crate) fn as_constant_inner<'tcx>(
expr: &Expr<'tcx>,
push_cuta: impl FnMut(&Box<CanonicalUserType<'tcx>>) -> Option<UserTypeAnnotationIndex>,
tcx: TyCtxt<'tcx>,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_build/src/build/expr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@

pub(crate) mod as_constant;
mod as_operand;
pub mod as_place;
pub(crate) mod as_place;
mod as_rvalue;
mod as_temp;
pub mod category;
pub(crate) mod category;
mod into;
mod stmt;
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/matches/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ impl<'a, 'b, 'tcx> FakeBorrowCollector<'a, 'b, 'tcx> {
}

#[must_use]
pub fn ref_pat_borrow_kind(ref_mutability: Mutability) -> BorrowKind {
pub(crate) fn ref_pat_borrow_kind(ref_mutability: Mutability) -> BorrowKind {
match ref_mutability {
Mutability::Mut => BorrowKind::Mut { kind: MutBorrowKind::Default },
Mutability::Not => BorrowKind::Shared,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ use rustc_span::{Span, DUMMY_SP};
use tracing::{debug, instrument};

#[derive(Debug)]
pub struct Scopes<'tcx> {
pub(crate) struct Scopes<'tcx> {
scopes: Vec<Scope>,

/// The current set of breakable scopes. See module comment for more details.
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_build/src/check_unsafety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ enum UnsafeOpKind {
use UnsafeOpKind::*;

impl UnsafeOpKind {
pub fn emit_unsafe_op_in_unsafe_fn_lint(
fn emit_unsafe_op_in_unsafe_fn_lint(
&self,
tcx: TyCtxt<'_>,
hir_id: HirId,
Expand Down Expand Up @@ -737,7 +737,7 @@ impl UnsafeOpKind {
}
}

pub fn emit_requires_unsafe_err(
fn emit_requires_unsafe_err(
&self,
tcx: TyCtxt<'_>,
span: Span,
Expand Down
Loading
Loading