1
Fork 0

Remove on_all_drop_children_bits.

As drop elaboration only tracks places that need dropping, is has become
equivalent to `on_all_children_bits`.
This commit is contained in:
Camille GILLOT 2023-10-01 08:47:12 +00:00
parent c9c0c0cbca
commit 547af00019
4 changed files with 18 additions and 36 deletions

View file

@ -75,29 +75,6 @@ pub fn on_all_children_bits<'tcx, F>(
on_all_children_bits(tcx, body, move_data, move_path_index, &mut each_child);
}
pub fn on_all_drop_children_bits<'tcx, F>(
tcx: TyCtxt<'tcx>,
body: &Body<'tcx>,
ctxt: &MoveDataParamEnv<'tcx>,
path: MovePathIndex,
mut each_child: F,
) where
F: FnMut(MovePathIndex),
{
on_all_children_bits(tcx, body, &ctxt.move_data, path, |child| {
let place = &ctxt.move_data.move_paths[path].place;
let ty = place.ty(body, tcx).ty;
debug!("on_all_drop_children_bits({:?}, {:?} : {:?})", path, place, ty);
let erased_ty = tcx.erase_regions(ty);
if erased_ty.needs_drop(tcx, ctxt.param_env) {
each_child(child);
} else {
debug!("on_all_drop_children_bits - skipping")
}
})
}
pub fn drop_flag_effects_for_function_entry<'tcx, F>(
tcx: TyCtxt<'tcx>,
body: &Body<'tcx>,

View file

@ -10,7 +10,7 @@ use crate::framework::SwitchIntEdgeEffects;
use crate::move_paths::{HasMoveData, InitIndex, InitKind, LookupResult, MoveData, MovePathIndex};
use crate::on_lookup_result_bits;
use crate::MoveDataParamEnv;
use crate::{drop_flag_effects, on_all_children_bits, on_all_drop_children_bits};
use crate::{drop_flag_effects, on_all_children_bits};
use crate::{lattice, AnalysisDomain, GenKill, GenKillAnalysis, MaybeReachable};
/// `MaybeInitializedPlaces` tracks all places that might be
@ -72,7 +72,7 @@ impl<'a, 'tcx> MaybeInitializedPlaces<'a, 'tcx> {
) -> bool {
if let LookupResult::Exact(path) = self.move_data().rev_lookup.find(place.as_ref()) {
let mut maybe_live = false;
on_all_drop_children_bits(self.tcx, self.body, self.mdpe, path, |child| {
on_all_children_bits(self.tcx, self.body, self.move_data(), path, |child| {
maybe_live |= state.contains(child);
});
!maybe_live

View file

@ -23,8 +23,7 @@ use rustc_span::symbol::{sym, Symbol};
pub use self::drop_flag_effects::{
drop_flag_effects_for_function_entry, drop_flag_effects_for_location,
move_path_children_matching, on_all_children_bits, on_all_drop_children_bits,
on_lookup_result_bits,
move_path_children_matching, on_all_children_bits, on_lookup_result_bits,
};
pub use self::framework::{
fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, AnalysisResults, Backward,