@@ -16,7 +16,6 @@ use rustc_trait_selection::traits::query::type_op::{DropckOutlives, TypeOp, Type
1616use tracing:: debug;
1717
1818use crate :: polonius;
19- use crate :: polonius:: legacy:: RichLocation ;
2019use crate :: region_infer:: values:: { self , LiveLoans } ;
2120use crate :: type_check:: liveness:: local_use_map:: LocalUseMap ;
2221use crate :: type_check:: { NormalizeLocation , TypeChecker } ;
@@ -211,7 +210,7 @@ impl<'a, 'typeck, 'b, 'tcx> LivenessResults<'a, 'typeck, 'b, 'tcx> {
211210 ///
212211 /// Add facts for all locals with free regions, since regions may outlive
213212 /// the function body only at certain nodes in the CFG.
214- fn add_extra_drop_facts ( & mut self , relevant_live_locals : & [ Local ] ) -> Option < ( ) > {
213+ fn add_extra_drop_facts ( & mut self , relevant_live_locals : & [ Local ] ) {
215214 // This collect is more necessary than immediately apparent
216215 // because these facts go into `add_drop_live_facts_for()`,
217216 // which also writes to `all_facts`, and so this is genuinely
@@ -221,41 +220,30 @@ impl<'a, 'typeck, 'b, 'tcx> LivenessResults<'a, 'typeck, 'b, 'tcx> {
221220 // and probably maybe plausibly does not need to go back in.
222221 // It may be necessary to just pick out the parts of
223222 // `add_drop_live_facts_for()` that make sense.
223+ let Some ( facts) = self . cx . typeck . all_facts . as_ref ( ) else { return } ;
224224 let facts_to_add: Vec < _ > = {
225- let drop_used = & self . cx . typeck . all_facts . as_ref ( ) ?. var_dropped_at ;
226-
227225 let relevant_live_locals: FxIndexSet < _ > =
228226 relevant_live_locals. iter ( ) . copied ( ) . collect ( ) ;
229227
230- drop_used
228+ facts
229+ . var_dropped_at
231230 . iter ( )
232- . filter_map ( |( local, location_index) | {
233- let local_ty = self . cx . body . local_decls [ * local] . ty ;
234- if relevant_live_locals. contains ( local) || !local_ty. has_free_regions ( ) {
231+ . filter_map ( |& ( local, location_index) | {
232+ let local_ty = self . cx . body . local_decls [ local] . ty ;
233+ if relevant_live_locals. contains ( & local) || !local_ty. has_free_regions ( ) {
235234 return None ;
236235 }
237236
238- let location = match self . cx . typeck . location_table . to_location ( * location_index)
239- {
240- RichLocation :: Start ( l) => l,
241- RichLocation :: Mid ( l) => l,
242- } ;
243-
244- Some ( ( * local, local_ty, location) )
237+ let location = self . cx . typeck . location_table . to_location ( location_index) ;
238+ Some ( ( local, local_ty, location) )
245239 } )
246240 . collect ( )
247241 } ;
248242
249- // FIXME: these locations seem to have a special meaning (e.g. everywhere, at the end,
250- // ...), but I don't know which one. Please help me rename it to something descriptive!
251- // Also, if this IntervalSet is used in many places, it maybe should have a newtype'd
252- // name with a description of what it means for future mortals passing by.
253- let locations = IntervalSet :: new ( self . cx . elements . num_points ( ) ) ;
254-
243+ let live_at = IntervalSet :: new ( self . cx . elements . num_points ( ) ) ;
255244 for ( local, local_ty, location) in facts_to_add {
256- self . cx . add_drop_live_facts_for ( local, local_ty, & [ location] , & locations ) ;
245+ self . cx . add_drop_live_facts_for ( local, local_ty, & [ location] , & live_at ) ;
257246 }
258- Some ( ( ) )
259247 }
260248
261249 /// Clear the value of fields that are "per local variable".
0 commit comments