@@ -81,8 +81,6 @@ pub(super) fn trace<'mir, 'tcx>(
8181 borrowck_context. constraints . liveness_constraints . loans = Some ( live_loans) ;
8282 } ;
8383
84- let polonius_facts_gathered = typeck. borrowck_context . all_facts . is_some ( ) ;
85-
8684 let cx = LivenessContext {
8785 typeck,
8886 body,
@@ -95,9 +93,7 @@ pub(super) fn trace<'mir, 'tcx>(
9593
9694 let mut results = LivenessResults :: new ( cx) ;
9795
98- if polonius_facts_gathered {
99- results. add_extra_drop_facts ( relevant_live_locals. iter ( ) . copied ( ) . collect ( ) ) ;
100- }
96+ results. add_extra_drop_facts ( & relevant_live_locals) ;
10197
10298 results. compute_for_all_locals ( relevant_live_locals) ;
10399
@@ -220,16 +216,17 @@ impl<'me, 'typeck, 'flow, 'tcx> LivenessResults<'me, 'typeck, 'flow, 'tcx> {
220216 ///
221217 /// Add facts for all locals with free regions, since regions may outlive
222218 /// the function body only at certain nodes in the CFG.
223- fn add_extra_drop_facts ( & mut self , relevant_live_locals : FxIndexSet < Local > ) {
219+ fn add_extra_drop_facts ( & mut self , relevant_live_locals : & [ Local ] ) -> Option < ( ) > {
224220 let drop_used = self
225221 . cx
226222 . typeck
227223 . borrowck_context
228224 . all_facts
229225 . as_ref ( )
230- . map ( |facts| facts. var_dropped_at . clone ( ) )
231- . into_iter ( )
232- . flatten ( ) ;
226+ . map ( |facts| facts. var_dropped_at . clone ( ) ) ?;
227+
228+ let relevant_live_locals: FxIndexSet < _ > = relevant_live_locals. iter ( ) . copied ( ) . collect ( ) ;
229+
233230 let locations = IntervalSet :: new ( self . cx . elements . num_points ( ) ) ;
234231
235232 for ( local, location_index) in drop_used {
@@ -250,6 +247,7 @@ impl<'me, 'typeck, 'flow, 'tcx> LivenessResults<'me, 'typeck, 'flow, 'tcx> {
250247 }
251248 }
252249 }
250+ Some ( ( ) )
253251 }
254252
255253 /// Clear the value of fields that are "per local variable".
0 commit comments