1515use rustc:: middle:: ty;
1616use rustc:: mir:: repr:: * ;
1717use rustc:: mir:: visit:: MutVisitor ;
18- use transform:: MirPass ;
1918use rustc:: mir:: mir_map:: MirMap ;
19+ use rustc:: mir:: transform:: MirPass ;
2020
2121pub fn erase_regions < ' tcx > ( tcx : & ty:: ctxt < ' tcx > , mir_map : & mut MirMap < ' tcx > ) {
22- let mut eraser = EraseRegions :: new ( tcx ) ;
22+ let mut eraser = EraseRegions ;
2323
24- eraser. run_on_mir ( mir) ;
2524 for ( _, mir) in & mut mir_map. map {
25+ eraser. run_on_mir ( mir, tcx) ;
2626 }
2727}
2828
29- pub struct EraseRegions < ' a , ' tcx : ' a > {
29+ pub struct EraseRegions ;
30+
31+ struct EraseRegionsVisitor < ' a , ' tcx : ' a > {
3032 tcx : & ' a ty:: ctxt < ' tcx > ,
3133}
3234
33- impl < ' a , ' tcx > EraseRegions < ' a , ' tcx > {
34- pub fn new ( tcx : & ' a ty:: ctxt < ' tcx > ) -> EraseRegions < ' a , ' tcx > {
35- EraseRegions {
35+ impl < ' a , ' tcx > EraseRegionsVisitor < ' a , ' tcx > {
36+ pub fn new ( tcx : & ' a ty:: ctxt < ' tcx > ) -> Self {
37+ EraseRegionsVisitor {
3638 tcx : tcx
3739 }
3840 }
@@ -56,13 +58,13 @@ impl<'a, 'tcx> EraseRegions<'a, 'tcx> {
5658 }
5759}
5860
59- impl < ' a , ' tcx > MirPass < ' tcx > for EraseRegions < ' a , ' tcx > {
60- fn run_on_mir ( & mut self , mir : & mut Mir < ' tcx > ) {
61- self . visit_mir ( mir) ;
61+ impl MirPass for EraseRegions {
62+ fn run_on_mir < ' tcx > ( & mut self , mir : & mut Mir < ' tcx > , tcx : & ty :: ctxt < ' tcx > ) {
63+ EraseRegionsVisitor :: new ( tcx ) . visit_mir ( mir) ;
6264 }
6365}
6466
65- impl < ' a , ' tcx > MutVisitor < ' tcx > for EraseRegions < ' a , ' tcx > {
67+ impl < ' a , ' tcx > MutVisitor < ' tcx > for EraseRegionsVisitor < ' a , ' tcx > {
6668 fn visit_mir ( & mut self , mir : & mut Mir < ' tcx > ) {
6769 self . erase_regions_return_ty ( & mut mir. return_ty ) ;
6870 self . erase_regions_tys ( mir. var_decls . iter_mut ( ) . map ( |d| & mut d. ty ) ) ;
0 commit comments