@@ -137,45 +137,35 @@ impl InitializationData<'_, '_> {
137137 }
138138}
139139
140- struct Elaborator < ' a , ' b , ' tcx > {
141- ctxt : & ' a mut ElaborateDropsCtxt < ' b , ' tcx > ,
142- }
143-
144- impl fmt:: Debug for Elaborator < ' _ , ' _ , ' _ > {
145- fn fmt ( & self , _f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
146- Ok ( ( ) )
147- }
148- }
149-
150- impl < ' b , ' tcx > DropElaborator < ' b , ' tcx > for Elaborator < ' _ , ' b , ' tcx > {
140+ impl < ' a , ' tcx > DropElaborator < ' a , ' tcx > for ElaborateDropsCtxt < ' a , ' tcx > {
151141 type Path = MovePathIndex ;
152142
153143 fn patch ( & mut self ) -> & mut MirPatch < ' tcx > {
154- & mut self . ctxt . patch
144+ & mut self . patch
155145 }
156146
157- fn body ( & self ) -> & ' b Body < ' tcx > {
158- self . ctxt . body
147+ fn body ( & self ) -> & ' a Body < ' tcx > {
148+ self . body
159149 }
160150
161151 fn tcx ( & self ) -> TyCtxt < ' tcx > {
162- self . ctxt . tcx
152+ self . tcx
163153 }
164154
165155 fn param_env ( & self ) -> ty:: ParamEnv < ' tcx > {
166- self . ctxt . param_env ( )
156+ self . param_env ( )
167157 }
168158
169159 #[ instrument( level = "debug" , skip( self ) , ret) ]
170160 fn drop_style ( & self , path : Self :: Path , mode : DropFlagMode ) -> DropStyle {
171161 let ( ( maybe_live, maybe_dead) , multipart) = match mode {
172- DropFlagMode :: Shallow => ( self . ctxt . init_data . maybe_live_dead ( path) , false ) ,
162+ DropFlagMode :: Shallow => ( self . init_data . maybe_live_dead ( path) , false ) ,
173163 DropFlagMode :: Deep => {
174164 let mut some_live = false ;
175165 let mut some_dead = false ;
176166 let mut children_count = 0 ;
177- on_all_children_bits ( self . ctxt . move_data ( ) , path, |child| {
178- let ( live, dead) = self . ctxt . init_data . maybe_live_dead ( child) ;
167+ on_all_children_bits ( self . move_data ( ) , path, |child| {
168+ let ( live, dead) = self . init_data . maybe_live_dead ( child) ;
179169 debug ! ( "elaborate_drop: state({:?}) = {:?}" , child, ( live, dead) ) ;
180170 some_live |= live;
181171 some_dead |= dead;
@@ -195,25 +185,25 @@ impl<'b, 'tcx> DropElaborator<'b, 'tcx> for Elaborator<'_, 'b, 'tcx> {
195185 fn clear_drop_flag ( & mut self , loc : Location , path : Self :: Path , mode : DropFlagMode ) {
196186 match mode {
197187 DropFlagMode :: Shallow => {
198- self . ctxt . set_drop_flag ( loc, path, DropFlagState :: Absent ) ;
188+ self . set_drop_flag ( loc, path, DropFlagState :: Absent ) ;
199189 }
200190 DropFlagMode :: Deep => {
201- on_all_children_bits ( self . ctxt . move_data ( ) , path, |child| {
202- self . ctxt . set_drop_flag ( loc, child, DropFlagState :: Absent )
191+ on_all_children_bits ( self . move_data ( ) , path, |child| {
192+ self . set_drop_flag ( loc, child, DropFlagState :: Absent )
203193 } ) ;
204194 }
205195 }
206196 }
207197
208198 fn field_subpath ( & self , path : Self :: Path , field : FieldIdx ) -> Option < Self :: Path > {
209- rustc_mir_dataflow:: move_path_children_matching ( self . ctxt . move_data ( ) , path, |e| match e {
199+ rustc_mir_dataflow:: move_path_children_matching ( self . move_data ( ) , path, |e| match e {
210200 ProjectionElem :: Field ( idx, _) => idx == field,
211201 _ => false ,
212202 } )
213203 }
214204
215205 fn array_subpath ( & self , path : Self :: Path , index : u64 , size : u64 ) -> Option < Self :: Path > {
216- rustc_mir_dataflow:: move_path_children_matching ( self . ctxt . move_data ( ) , path, |e| match e {
206+ rustc_mir_dataflow:: move_path_children_matching ( self . move_data ( ) , path, |e| match e {
217207 ProjectionElem :: ConstantIndex { offset, min_length, from_end } => {
218208 debug_assert ! ( size == min_length, "min_length should be exact for arrays" ) ;
219209 assert ! ( !from_end, "from_end should not be used for array element ConstantIndex" ) ;
@@ -224,20 +214,20 @@ impl<'b, 'tcx> DropElaborator<'b, 'tcx> for Elaborator<'_, 'b, 'tcx> {
224214 }
225215
226216 fn deref_subpath ( & self , path : Self :: Path ) -> Option < Self :: Path > {
227- rustc_mir_dataflow:: move_path_children_matching ( self . ctxt . move_data ( ) , path, |e| {
217+ rustc_mir_dataflow:: move_path_children_matching ( self . move_data ( ) , path, |e| {
228218 e == ProjectionElem :: Deref
229219 } )
230220 }
231221
232222 fn downcast_subpath ( & self , path : Self :: Path , variant : VariantIdx ) -> Option < Self :: Path > {
233- rustc_mir_dataflow:: move_path_children_matching ( self . ctxt . move_data ( ) , path, |e| match e {
223+ rustc_mir_dataflow:: move_path_children_matching ( self . move_data ( ) , path, |e| match e {
234224 ProjectionElem :: Downcast ( _, idx) => idx == variant,
235225 _ => false ,
236226 } )
237227 }
238228
239229 fn get_drop_flag ( & mut self , path : Self :: Path ) -> Option < Operand < ' tcx > > {
240- self . ctxt . drop_flag ( path) . map ( Operand :: Copy )
230+ self . drop_flag ( path) . map ( Operand :: Copy )
241231 }
242232}
243233
@@ -250,6 +240,12 @@ struct ElaborateDropsCtxt<'a, 'tcx> {
250240 patch : MirPatch < ' tcx > ,
251241}
252242
243+ impl fmt:: Debug for ElaborateDropsCtxt < ' _ , ' _ > {
244+ fn fmt ( & self , _f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
245+ Ok ( ( ) )
246+ }
247+ }
248+
253249impl < ' a , ' tcx > ElaborateDropsCtxt < ' a , ' tcx > {
254250 fn move_data ( & self ) -> & ' a MoveData < ' tcx > {
255251 & self . env . move_data
@@ -370,15 +366,7 @@ impl<'a, 'tcx> ElaborateDropsCtxt<'a, 'tcx> {
370366 }
371367 } ;
372368 self . init_data . seek_before ( self . body . terminator_loc ( bb) ) ;
373- elaborate_drop (
374- & mut Elaborator { ctxt : self } ,
375- terminator. source_info ,
376- place,
377- path,
378- target,
379- unwind,
380- bb,
381- )
369+ elaborate_drop ( self , terminator. source_info , place, path, target, unwind, bb)
382370 }
383371 LookupResult :: Parent ( None ) => { }
384372 LookupResult :: Parent ( Some ( _) ) => {
0 commit comments