@@ -59,7 +59,7 @@ const fn c_name(name: &'static str) -> &'static str {
59
59
/// A streamlined trait that you can implement to create a pass; the
60
60
/// pass will be named after the type, and it will consist of a main
61
61
/// loop that goes over each available MIR and applies `run_pass`.
62
- pub trait MirPass < ' tcx > {
62
+ pub ( super ) trait MirPass < ' tcx > {
63
63
fn name ( & self ) -> & ' static str {
64
64
// FIXME Simplify the implementation once more `str` methods get const-stable.
65
65
// See copypaste in `MirLint`
@@ -86,7 +86,7 @@ pub trait MirPass<'tcx> {
86
86
}
87
87
88
88
/// Just like `MirPass`, except it cannot mutate `Body`.
89
- pub trait MirLint < ' tcx > {
89
+ pub ( super ) trait MirLint < ' tcx > {
90
90
fn name ( & self ) -> & ' static str {
91
91
// FIXME Simplify the implementation once more `str` methods get const-stable.
92
92
// See copypaste in `MirPass`
@@ -105,7 +105,7 @@ pub trait MirLint<'tcx> {
105
105
106
106
/// An adapter for `MirLint`s that implements `MirPass`.
107
107
#[ derive( Debug , Clone ) ]
108
- pub struct Lint < T > ( pub T ) ;
108
+ pub ( super ) struct Lint < T > ( pub T ) ;
109
109
110
110
impl < ' tcx , T > MirPass < ' tcx > for Lint < T >
111
111
where
@@ -128,7 +128,7 @@ where
128
128
}
129
129
}
130
130
131
- pub struct WithMinOptLevel < T > ( pub u32 , pub T ) ;
131
+ pub ( super ) struct WithMinOptLevel < T > ( pub u32 , pub T ) ;
132
132
133
133
impl < ' tcx , T > MirPass < ' tcx > for WithMinOptLevel < T >
134
134
where
@@ -149,7 +149,7 @@ where
149
149
150
150
/// Run the sequence of passes without validating the MIR after each pass. The MIR is still
151
151
/// validated at the end.
152
- pub fn run_passes_no_validate < ' tcx > (
152
+ pub ( super ) fn run_passes_no_validate < ' tcx > (
153
153
tcx : TyCtxt < ' tcx > ,
154
154
body : & mut Body < ' tcx > ,
155
155
passes : & [ & dyn MirPass < ' tcx > ] ,
@@ -159,7 +159,7 @@ pub fn run_passes_no_validate<'tcx>(
159
159
}
160
160
161
161
/// 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 > (
163
163
tcx : TyCtxt < ' tcx > ,
164
164
body : & mut Body < ' tcx > ,
165
165
passes : & [ & dyn MirPass < ' tcx > ] ,
@@ -168,7 +168,7 @@ pub fn run_passes<'tcx>(
168
168
run_passes_inner ( tcx, body, passes, phase_change, true ) ;
169
169
}
170
170
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
172
172
where
173
173
P : MirPass < ' tcx > + ?Sized ,
174
174
{
@@ -264,11 +264,11 @@ fn run_passes_inner<'tcx>(
264
264
}
265
265
}
266
266
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 ) {
268
268
validate:: Validator { when, mir_phase : body. phase } . run_pass ( tcx, body) ;
269
269
}
270
270
271
- pub fn dump_mir_for_pass < ' tcx > (
271
+ pub ( super ) fn dump_mir_for_pass < ' tcx > (
272
272
tcx : TyCtxt < ' tcx > ,
273
273
body : & Body < ' tcx > ,
274
274
pass_name : & str ,
@@ -284,7 +284,7 @@ pub fn dump_mir_for_pass<'tcx>(
284
284
) ;
285
285
}
286
286
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 > ) {
288
288
assert_eq ! ( body. pass_count, 0 ) ;
289
289
mir:: dump_mir ( tcx, true , body. phase . name ( ) , & "after" , body, |_, _| Ok ( ( ) ) )
290
290
}
0 commit comments