Fix back-porting drop-livess from Polonius to tracing

This commit is contained in:
Amanda Stjerna 2024-05-28 12:57:26 +02:00
parent c0d600385b
commit 077a8219b0

View File

@ -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,
}
@ -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) {
@ -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()");
@ -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,