Stop using MoveDataParamEnv for places that don't need a param-env
This commit is contained in:
parent
4db3d12e6f
commit
f990239b34
6 changed files with 53 additions and 64 deletions
|
@ -3,7 +3,7 @@ use rustc_middle::mir::{Body, TerminatorKind};
|
|||
use rustc_middle::ty::{self, GenericArgsRef, ParamEnv, Ty, TyCtxt, VariantDef};
|
||||
use rustc_mir_dataflow::impls::MaybeInitializedPlaces;
|
||||
use rustc_mir_dataflow::move_paths::{LookupResult, MoveData, MovePathIndex};
|
||||
use rustc_mir_dataflow::{move_path_children_matching, Analysis, MaybeReachable, MoveDataParamEnv};
|
||||
use rustc_mir_dataflow::{move_path_children_matching, Analysis, MaybeReachable};
|
||||
use rustc_target::abi::FieldIdx;
|
||||
|
||||
use crate::MirPass;
|
||||
|
@ -24,8 +24,7 @@ impl<'tcx> MirPass<'tcx> for RemoveUninitDrops {
|
|||
let move_data =
|
||||
MoveData::gather_moves(body, tcx, param_env, |ty| ty.needs_drop(tcx, param_env));
|
||||
|
||||
let mdpe = MoveDataParamEnv { move_data, param_env };
|
||||
let mut maybe_inits = MaybeInitializedPlaces::new(tcx, body, &mdpe)
|
||||
let mut maybe_inits = MaybeInitializedPlaces::new(tcx, body, &move_data)
|
||||
.into_engine(tcx, body)
|
||||
.pass_name("remove_uninit_drops")
|
||||
.iterate_to_fixpoint()
|
||||
|
@ -40,7 +39,7 @@ impl<'tcx> MirPass<'tcx> for RemoveUninitDrops {
|
|||
let MaybeReachable::Reachable(maybe_inits) = maybe_inits.get() else { continue };
|
||||
|
||||
// If there's no move path for the dropped place, it's probably a `Deref`. Let it alone.
|
||||
let LookupResult::Exact(mpi) = mdpe.move_data.rev_lookup.find(place.as_ref()) else {
|
||||
let LookupResult::Exact(mpi) = move_data.rev_lookup.find(place.as_ref()) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
|
@ -48,7 +47,7 @@ impl<'tcx> MirPass<'tcx> for RemoveUninitDrops {
|
|||
tcx,
|
||||
param_env,
|
||||
maybe_inits,
|
||||
&mdpe.move_data,
|
||||
&move_data,
|
||||
place.ty(body, tcx).ty,
|
||||
mpi,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue