1
Fork 0

Auto merge of #125602 - RalfJung:interpret-mir-lifetime, r=oli-obk

interpret: get rid of 'mir lifetime

I realized our MIR bodies are actually at lifetime `'tcx`, so we don't need to carry around this other lifetime everywhere.

r? `@oli-obk`
This commit is contained in:
bors 2024-05-27 11:01:15 +00:00
commit a59072ec4f
88 changed files with 727 additions and 815 deletions

View file

@ -69,7 +69,7 @@ struct ConstAnalysis<'a, 'tcx> {
map: Map,
tcx: TyCtxt<'tcx>,
local_decls: &'a LocalDecls<'tcx>,
ecx: InterpCx<'tcx, 'tcx, DummyMachine>,
ecx: InterpCx<'tcx, DummyMachine>,
param_env: ty::ParamEnv<'tcx>,
}
@ -143,10 +143,9 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> {
};
if let Some(variant_target_idx) = variant_target {
for (field_index, operand) in operands.iter_enumerated() {
if let Some(field) = self.map().apply(
variant_target_idx,
TrackElem::Field(field_index),
) {
if let Some(field) =
self.map().apply(variant_target_idx, TrackElem::Field(field_index))
{
self.assign_operand(state, field, operand);
}
}
@ -565,7 +564,7 @@ impl<'tcx, 'locals> Collector<'tcx, 'locals> {
fn try_make_constant(
&self,
ecx: &mut InterpCx<'tcx, 'tcx, DummyMachine>,
ecx: &mut InterpCx<'tcx, DummyMachine>,
place: Place<'tcx>,
state: &State<FlatSet<Scalar>>,
map: &Map,
@ -618,7 +617,7 @@ fn propagatable_scalar(
#[instrument(level = "trace", skip(ecx, state, map))]
fn try_write_constant<'tcx>(
ecx: &mut InterpCx<'_, 'tcx, DummyMachine>,
ecx: &mut InterpCx<'tcx, DummyMachine>,
dest: &PlaceTy<'tcx>,
place: PlaceIndex,
ty: Ty<'tcx>,
@ -836,7 +835,7 @@ impl<'tcx> MutVisitor<'tcx> for Patch<'tcx> {
struct OperandCollector<'tcx, 'map, 'locals, 'a> {
state: &'a State<FlatSet<Scalar>>,
visitor: &'a mut Collector<'tcx, 'locals>,
ecx: &'map mut InterpCx<'tcx, 'tcx, DummyMachine>,
ecx: &'map mut InterpCx<'tcx, DummyMachine>,
map: &'map Map,
}

View file

@ -234,7 +234,7 @@ enum Value<'tcx> {
struct VnState<'body, 'tcx> {
tcx: TyCtxt<'tcx>,
ecx: InterpCx<'tcx, 'tcx, DummyMachine>,
ecx: InterpCx<'tcx, DummyMachine>,
param_env: ty::ParamEnv<'tcx>,
local_decls: &'body LocalDecls<'tcx>,
/// Value stored in each local.
@ -1139,7 +1139,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
}
fn op_to_prop_const<'tcx>(
ecx: &mut InterpCx<'_, 'tcx, DummyMachine>,
ecx: &mut InterpCx<'tcx, DummyMachine>,
op: &OpTy<'tcx>,
) -> Option<ConstValue<'tcx>> {
// Do not attempt to propagate unsized locals.

View file

@ -155,7 +155,7 @@ struct ThreadingOpportunity {
struct TOFinder<'tcx, 'a> {
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
ecx: InterpCx<'tcx, 'tcx, DummyMachine>,
ecx: InterpCx<'tcx, DummyMachine>,
body: &'a Body<'tcx>,
map: &'a Map,
loop_headers: &'a BitSet<BasicBlock>,

View file

@ -64,7 +64,7 @@ impl<'tcx> MirLint<'tcx> for KnownPanicsLint {
/// Visits MIR nodes, performs const propagation
/// and runs lint checks as it goes
struct ConstPropagator<'mir, 'tcx> {
ecx: InterpCx<'mir, 'tcx, DummyMachine>,
ecx: InterpCx<'tcx, DummyMachine>,
tcx: TyCtxt<'tcx>,
param_env: ParamEnv<'tcx>,
worklist: Vec<BasicBlock>,