Skip to content

Commit 8272c6d

Browse files
Rollup merge of #125959 - nnethercote:rustc_mir_build-cleanups, r=compiler-errors
Reduce `pub` exposure in `rustc_mir_build` r? compiler
2 parents 23f39a2 + 5a5e248 commit 8272c6d

File tree

10 files changed

+275
-277
lines changed

10 files changed

+275
-277
lines changed

Diff for: compiler/rustc_mir_build/src/build/coverageinfo/mcdc.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,18 @@ impl MCDCState {
179179
}
180180
}
181181

182-
pub struct MCDCInfoBuilder {
182+
pub(crate) struct MCDCInfoBuilder {
183183
branch_spans: Vec<MCDCBranchSpan>,
184184
decision_spans: Vec<MCDCDecisionSpan>,
185185
state: MCDCState,
186186
}
187187

188188
impl MCDCInfoBuilder {
189-
pub fn new() -> Self {
189+
pub(crate) fn new() -> Self {
190190
Self { branch_spans: vec![], decision_spans: vec![], state: MCDCState::new() }
191191
}
192192

193-
pub fn visit_evaluated_condition(
193+
pub(crate) fn visit_evaluated_condition(
194194
&mut self,
195195
tcx: TyCtxt<'_>,
196196
source_info: SourceInfo,
@@ -243,7 +243,7 @@ impl MCDCInfoBuilder {
243243
});
244244
}
245245

246-
pub fn into_done(self) -> (Vec<MCDCDecisionSpan>, Vec<MCDCBranchSpan>) {
246+
pub(crate) fn into_done(self) -> (Vec<MCDCDecisionSpan>, Vec<MCDCBranchSpan>) {
247247
(self.decision_spans, self.branch_spans)
248248
}
249249
}

Diff for: compiler/rustc_mir_build/src/build/custom/parse.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
9191
}
9292
}
9393

94-
pub fn parse_args(&mut self, params: &IndexSlice<ParamId, Param<'tcx>>) -> PResult<()> {
94+
pub(crate) fn parse_args(&mut self, params: &IndexSlice<ParamId, Param<'tcx>>) -> PResult<()> {
9595
for param in params.iter() {
9696
let (var, span) = {
9797
let pat = param.pat.as_ref().unwrap();
@@ -149,7 +149,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
149149
///
150150
/// This allows us to easily parse the basic blocks declarations, local declarations, and
151151
/// basic block definitions in order.
152-
pub fn parse_body(&mut self, expr_id: ExprId) -> PResult<()> {
152+
pub(crate) fn parse_body(&mut self, expr_id: ExprId) -> PResult<()> {
153153
let body = parse_by_kind!(self, expr_id, _, "whole body",
154154
ExprKind::Block { block } => self.thir[*block].expr.unwrap(),
155155
);

Diff for: compiler/rustc_mir_build/src/build/custom/parse/instruction.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::build::expr::as_constant::as_constant_inner;
1212
use super::{parse_by_kind, PResult, ParseCtxt};
1313

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

49-
pub fn parse_terminator(&self, expr_id: ExprId) -> PResult<TerminatorKind<'tcx>> {
49+
pub(crate) fn parse_terminator(&self, expr_id: ExprId) -> PResult<TerminatorKind<'tcx>> {
5050
parse_by_kind!(self, expr_id, expr, "terminator",
5151
@call(mir_return, _args) => {
5252
Ok(TerminatorKind::Return)
@@ -261,7 +261,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
261261
)
262262
}
263263

264-
pub fn parse_operand(&self, expr_id: ExprId) -> PResult<Operand<'tcx>> {
264+
pub(crate) fn parse_operand(&self, expr_id: ExprId) -> PResult<Operand<'tcx>> {
265265
parse_by_kind!(self, expr_id, expr, "operand",
266266
@call(mir_move, args) => self.parse_place(args[0]).map(Operand::Move),
267267
@call(mir_static, args) => self.parse_static(args[0]),

Diff for: compiler/rustc_mir_build/src/build/expr/as_constant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
3939
}
4040
}
4141

42-
pub fn as_constant_inner<'tcx>(
42+
pub(crate) fn as_constant_inner<'tcx>(
4343
expr: &Expr<'tcx>,
4444
push_cuta: impl FnMut(&Box<CanonicalUserType<'tcx>>) -> Option<UserTypeAnnotationIndex>,
4545
tcx: TyCtxt<'tcx>,

Diff for: compiler/rustc_mir_build/src/build/expr/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262
6363
pub(crate) mod as_constant;
6464
mod as_operand;
65-
pub mod as_place;
65+
pub(crate) mod as_place;
6666
mod as_rvalue;
6767
mod as_temp;
68-
pub mod category;
68+
pub(crate) mod category;
6969
mod into;
7070
mod stmt;

Diff for: compiler/rustc_mir_build/src/build/matches/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ impl<'a, 'b, 'tcx> FakeBorrowCollector<'a, 'b, 'tcx> {
456456
}
457457

458458
#[must_use]
459-
pub fn ref_pat_borrow_kind(ref_mutability: Mutability) -> BorrowKind {
459+
pub(crate) fn ref_pat_borrow_kind(ref_mutability: Mutability) -> BorrowKind {
460460
match ref_mutability {
461461
Mutability::Mut => BorrowKind::Mut { kind: MutBorrowKind::Default },
462462
Mutability::Not => BorrowKind::Shared,

Diff for: compiler/rustc_mir_build/src/build/scope.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ use rustc_span::{Span, DUMMY_SP};
9797
use tracing::{debug, instrument};
9898

9999
#[derive(Debug)]
100-
pub struct Scopes<'tcx> {
100+
pub(crate) struct Scopes<'tcx> {
101101
scopes: Vec<Scope>,
102102

103103
/// The current set of breakable scopes. See module comment for more details.

Diff for: compiler/rustc_mir_build/src/check_unsafety.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ enum UnsafeOpKind {
597597
use UnsafeOpKind::*;
598598

599599
impl UnsafeOpKind {
600-
pub fn emit_unsafe_op_in_unsafe_fn_lint(
600+
fn emit_unsafe_op_in_unsafe_fn_lint(
601601
&self,
602602
tcx: TyCtxt<'_>,
603603
hir_id: HirId,
@@ -737,7 +737,7 @@ impl UnsafeOpKind {
737737
}
738738
}
739739

740-
pub fn emit_requires_unsafe_err(
740+
fn emit_requires_unsafe_err(
741741
&self,
742742
tcx: TyCtxt<'_>,
743743
span: Span,

0 commit comments

Comments
 (0)