Skip to content

Commit

Permalink
Fix back-porting drop-livess from Polonius to tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
amandasystems committed May 28, 2024
1 parent c0d6003 commit 077a821
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions compiler/rustc_borrowck/src/type_check/liveness/polonius.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct UseFactsExtractor<'me, 'tcx> {
var_defined_at: &'me mut VarPointRelation,
var_used_at: &'me mut VarPointRelation,
location_table: &'me LocationTable,
var_dropped_at: &'me mut VarPointRelation,
var_dropped_at: &'me mut Vec<(Local, Location)>,
move_data: &'me MoveData<'tcx>,
path_accessed_at_base: &'me mut PathPointRelation,
}
Expand All @@ -37,7 +37,7 @@ impl<'tcx> UseFactsExtractor<'_, 'tcx> {

fn insert_drop_use(&mut self, local: Local, location: Location) {
debug!("UseFactsExtractor::insert_drop_use()");
self.var_dropped_at.push((local, self.location_to_index(location)));
self.var_dropped_at.push((local, location));
}

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

0 comments on commit 077a821

Please sign in to comment.