@@ -16,7 +16,6 @@ use rustc_trait_selection::traits::query::type_op::{DropckOutlives, TypeOp, Type
16
16
use tracing:: debug;
17
17
18
18
use crate :: polonius;
19
- use crate :: polonius:: legacy:: RichLocation ;
20
19
use crate :: region_infer:: values:: { self , LiveLoans } ;
21
20
use crate :: type_check:: liveness:: local_use_map:: LocalUseMap ;
22
21
use crate :: type_check:: { NormalizeLocation , TypeChecker } ;
@@ -211,7 +210,7 @@ impl<'a, 'typeck, 'b, 'tcx> LivenessResults<'a, 'typeck, 'b, 'tcx> {
211
210
///
212
211
/// Add facts for all locals with free regions, since regions may outlive
213
212
/// 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 ] ) {
215
214
// This collect is more necessary than immediately apparent
216
215
// because these facts go into `add_drop_live_facts_for()`,
217
216
// 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> {
221
220
// and probably maybe plausibly does not need to go back in.
222
221
// It may be necessary to just pick out the parts of
223
222
// `add_drop_live_facts_for()` that make sense.
223
+ let Some ( facts) = self . cx . typeck . all_facts . as_ref ( ) else { return } ;
224
224
let facts_to_add: Vec < _ > = {
225
- let drop_used = & self . cx . typeck . all_facts . as_ref ( ) ?. var_dropped_at ;
226
-
227
225
let relevant_live_locals: FxIndexSet < _ > =
228
226
relevant_live_locals. iter ( ) . copied ( ) . collect ( ) ;
229
227
230
- drop_used
228
+ facts
229
+ . var_dropped_at
231
230
. 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 ( ) {
235
234
return None ;
236
235
}
237
236
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) )
245
239
} )
246
240
. collect ( )
247
241
} ;
248
242
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 ( ) ) ;
255
244
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 ) ;
257
246
}
258
- Some ( ( ) )
259
247
}
260
248
261
249
/// Clear the value of fields that are "per local variable".
0 commit comments