Skip to content

Commit 827fa43

Browse files
committed
Reduce visibility of MirPass and related things.
They're now all just used within this crate.
1 parent 2aae619 commit 827fa43

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

compiler/rustc_mir_transform/src/pass_manager.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const fn c_name(name: &'static str) -> &'static str {
5959
/// A streamlined trait that you can implement to create a pass; the
6060
/// pass will be named after the type, and it will consist of a main
6161
/// loop that goes over each available MIR and applies `run_pass`.
62-
pub trait MirPass<'tcx> {
62+
pub(super) trait MirPass<'tcx> {
6363
fn name(&self) -> &'static str {
6464
// FIXME Simplify the implementation once more `str` methods get const-stable.
6565
// See copypaste in `MirLint`
@@ -86,7 +86,7 @@ pub trait MirPass<'tcx> {
8686
}
8787

8888
/// Just like `MirPass`, except it cannot mutate `Body`.
89-
pub trait MirLint<'tcx> {
89+
pub(super) trait MirLint<'tcx> {
9090
fn name(&self) -> &'static str {
9191
// FIXME Simplify the implementation once more `str` methods get const-stable.
9292
// See copypaste in `MirPass`
@@ -105,7 +105,7 @@ pub trait MirLint<'tcx> {
105105

106106
/// An adapter for `MirLint`s that implements `MirPass`.
107107
#[derive(Debug, Clone)]
108-
pub struct Lint<T>(pub T);
108+
pub(super) struct Lint<T>(pub T);
109109

110110
impl<'tcx, T> MirPass<'tcx> for Lint<T>
111111
where
@@ -128,7 +128,7 @@ where
128128
}
129129
}
130130

131-
pub struct WithMinOptLevel<T>(pub u32, pub T);
131+
pub(super) struct WithMinOptLevel<T>(pub u32, pub T);
132132

133133
impl<'tcx, T> MirPass<'tcx> for WithMinOptLevel<T>
134134
where
@@ -149,7 +149,7 @@ where
149149

150150
/// Run the sequence of passes without validating the MIR after each pass. The MIR is still
151151
/// validated at the end.
152-
pub fn run_passes_no_validate<'tcx>(
152+
pub(super) fn run_passes_no_validate<'tcx>(
153153
tcx: TyCtxt<'tcx>,
154154
body: &mut Body<'tcx>,
155155
passes: &[&dyn MirPass<'tcx>],
@@ -159,7 +159,7 @@ pub fn run_passes_no_validate<'tcx>(
159159
}
160160

161161
/// The optional `phase_change` is applied after executing all the passes, if present
162-
pub fn run_passes<'tcx>(
162+
pub(super) fn run_passes<'tcx>(
163163
tcx: TyCtxt<'tcx>,
164164
body: &mut Body<'tcx>,
165165
passes: &[&dyn MirPass<'tcx>],
@@ -168,7 +168,7 @@ pub fn run_passes<'tcx>(
168168
run_passes_inner(tcx, body, passes, phase_change, true);
169169
}
170170

171-
pub fn should_run_pass<'tcx, P>(tcx: TyCtxt<'tcx>, pass: &P) -> bool
171+
pub(super) fn should_run_pass<'tcx, P>(tcx: TyCtxt<'tcx>, pass: &P) -> bool
172172
where
173173
P: MirPass<'tcx> + ?Sized,
174174
{
@@ -264,11 +264,11 @@ fn run_passes_inner<'tcx>(
264264
}
265265
}
266266

267-
pub fn validate_body<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, when: String) {
267+
pub(super) fn validate_body<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, when: String) {
268268
validate::Validator { when, mir_phase: body.phase }.run_pass(tcx, body);
269269
}
270270

271-
pub fn dump_mir_for_pass<'tcx>(
271+
pub(super) fn dump_mir_for_pass<'tcx>(
272272
tcx: TyCtxt<'tcx>,
273273
body: &Body<'tcx>,
274274
pass_name: &str,
@@ -284,7 +284,7 @@ pub fn dump_mir_for_pass<'tcx>(
284284
);
285285
}
286286

287-
pub fn dump_mir_for_phase_change<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
287+
pub(super) fn dump_mir_for_phase_change<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
288288
assert_eq!(body.pass_count, 0);
289289
mir::dump_mir(tcx, true, body.phase.name(), &"after", body, |_, _| Ok(()))
290290
}

0 commit comments

Comments
 (0)