diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-09-03 15:56:54 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-09-03 16:04:09 +1000 |
| commit | 827fa43392ded31eb8d2ec397e542581741f7295 (patch) | |
| tree | 4137e2d007b15c7123e97bd0187c673aa24c3759 /compiler/rustc_mir_transform/src | |
| parent | 2aae619edbf3f761894cac42a0074718219434df (diff) | |
| download | rust-827fa43392ded31eb8d2ec397e542581741f7295.tar.gz rust-827fa43392ded31eb8d2ec397e542581741f7295.zip | |
Reduce visibility of `MirPass` and related things.
They're now all just used within this crate.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/pass_manager.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/rustc_mir_transform/src/pass_manager.rs b/compiler/rustc_mir_transform/src/pass_manager.rs index 8b691c9e929..4f24139ba74 100644 --- a/compiler/rustc_mir_transform/src/pass_manager.rs +++ b/compiler/rustc_mir_transform/src/pass_manager.rs @@ -59,7 +59,7 @@ const fn c_name(name: &'static str) -> &'static str { /// A streamlined trait that you can implement to create a pass; the /// pass will be named after the type, and it will consist of a main /// loop that goes over each available MIR and applies `run_pass`. -pub trait MirPass<'tcx> { +pub(super) trait MirPass<'tcx> { fn name(&self) -> &'static str { // FIXME Simplify the implementation once more `str` methods get const-stable. // See copypaste in `MirLint` @@ -86,7 +86,7 @@ pub trait MirPass<'tcx> { } /// Just like `MirPass`, except it cannot mutate `Body`. -pub trait MirLint<'tcx> { +pub(super) trait MirLint<'tcx> { fn name(&self) -> &'static str { // FIXME Simplify the implementation once more `str` methods get const-stable. // See copypaste in `MirPass` @@ -105,7 +105,7 @@ pub trait MirLint<'tcx> { /// An adapter for `MirLint`s that implements `MirPass`. #[derive(Debug, Clone)] -pub struct Lint<T>(pub T); +pub(super) struct Lint<T>(pub T); impl<'tcx, T> MirPass<'tcx> for Lint<T> where @@ -128,7 +128,7 @@ where } } -pub struct WithMinOptLevel<T>(pub u32, pub T); +pub(super) struct WithMinOptLevel<T>(pub u32, pub T); impl<'tcx, T> MirPass<'tcx> for WithMinOptLevel<T> where @@ -149,7 +149,7 @@ where /// Run the sequence of passes without validating the MIR after each pass. The MIR is still /// validated at the end. -pub fn run_passes_no_validate<'tcx>( +pub(super) fn run_passes_no_validate<'tcx>( tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, passes: &[&dyn MirPass<'tcx>], @@ -159,7 +159,7 @@ pub fn run_passes_no_validate<'tcx>( } /// The optional `phase_change` is applied after executing all the passes, if present -pub fn run_passes<'tcx>( +pub(super) fn run_passes<'tcx>( tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, passes: &[&dyn MirPass<'tcx>], @@ -168,7 +168,7 @@ pub fn run_passes<'tcx>( run_passes_inner(tcx, body, passes, phase_change, true); } -pub fn should_run_pass<'tcx, P>(tcx: TyCtxt<'tcx>, pass: &P) -> bool +pub(super) fn should_run_pass<'tcx, P>(tcx: TyCtxt<'tcx>, pass: &P) -> bool where P: MirPass<'tcx> + ?Sized, { @@ -264,11 +264,11 @@ fn run_passes_inner<'tcx>( } } -pub fn validate_body<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, when: String) { +pub(super) fn validate_body<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, when: String) { validate::Validator { when, mir_phase: body.phase }.run_pass(tcx, body); } -pub fn dump_mir_for_pass<'tcx>( +pub(super) fn dump_mir_for_pass<'tcx>( tcx: TyCtxt<'tcx>, body: &Body<'tcx>, pass_name: &str, @@ -284,7 +284,7 @@ pub fn dump_mir_for_pass<'tcx>( ); } -pub fn dump_mir_for_phase_change<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) { +pub(super) fn dump_mir_for_phase_change<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) { assert_eq!(body.pass_count, 0); mir::dump_mir(tcx, true, body.phase.name(), &"after", body, |_, _| Ok(())) } |
