Skip to content

Commit 077a821

Browse files
committed
Fix back-porting drop-livess from Polonius to tracing
1 parent c0d6003 commit 077a821

File tree

1 file changed

+9
-5
lines changed
  • compiler/rustc_borrowck/src/type_check/liveness

1 file changed

+9
-5
lines changed

compiler/rustc_borrowck/src/type_check/liveness/polonius.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct UseFactsExtractor<'me, 'tcx> {
1414
var_defined_at: &'me mut VarPointRelation,
1515
var_used_at: &'me mut VarPointRelation,
1616
location_table: &'me LocationTable,
17-
var_dropped_at: &'me mut VarPointRelation,
17+
var_dropped_at: &'me mut Vec<(Local, Location)>,
1818
move_data: &'me MoveData<'tcx>,
1919
path_accessed_at_base: &'me mut PathPointRelation,
2020
}
@@ -37,7 +37,7 @@ impl<'tcx> UseFactsExtractor<'_, 'tcx> {
3737

3838
fn insert_drop_use(&mut self, local: Local, location: Location) {
3939
debug!("UseFactsExtractor::insert_drop_use()");
40-
self.var_dropped_at.push((local, self.location_to_index(location)));
40+
self.var_dropped_at.push((local, location));
4141
}
4242

4343
fn insert_path_access(&mut self, path: MovePathIndex, location: Location) {
@@ -87,8 +87,12 @@ pub(super) fn populate_access_facts<'a, 'tcx>(
8787
body: &Body<'tcx>,
8888
location_table: &LocationTable,
8989
move_data: &MoveData<'tcx>,
90-
//FIXME: this is not mutated, but expected to be modified as
91-
// out param, bug?
90+
// FIXME: this is an inelegant way of squirreling away a
91+
// copy of `var_dropped_at` in the original `Location` format
92+
// for later use in `trace::trace()`, which updates some liveness-
93+
// internal data based on what Polonius saw.
94+
// Ideally, that part would access the Polonius facts directly, and this
95+
// would be regular facts gathering.
9296
dropped_at: &mut Vec<(Local, Location)>,
9397
) {
9498
debug!("populate_access_facts()");
@@ -97,7 +101,7 @@ pub(super) fn populate_access_facts<'a, 'tcx>(
97101
let mut extractor = UseFactsExtractor {
98102
var_defined_at: &mut facts.var_defined_at,
99103
var_used_at: &mut facts.var_used_at,
100-
var_dropped_at: &mut facts.var_dropped_at,
104+
var_dropped_at: dropped_at,
101105
path_accessed_at_base: &mut facts.path_accessed_at_base,
102106
location_table,
103107
move_data,

0 commit comments

Comments
 (0)