Auto merge of #108250 - nnethercote:rename-interner-funcs, r=compiler-errors
Rename interner funcs This PR cleans up some inconsistencies in interner naming. Best reviewed one commit at a time. r? `@compiler-errors`
This commit is contained in:
commit
dcca6a375b
111 changed files with 448 additions and 469 deletions
|
@ -124,7 +124,7 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> {
|
|||
|
||||
fn visit_place(&mut self, place: &mut Place<'tcx>, ctxt: PlaceContext, loc: Location) {
|
||||
if let Some(new_projection) = self.process_projection(&place.projection, loc) {
|
||||
place.projection = self.tcx().intern_place_elems(&new_projection);
|
||||
place.projection = self.tcx().mk_place_elems(&new_projection);
|
||||
}
|
||||
|
||||
let observes_address = match ctxt {
|
||||
|
|
|
@ -17,7 +17,7 @@ pub fn build_ptr_tys<'tcx>(
|
|||
unique_did: DefId,
|
||||
nonnull_did: DefId,
|
||||
) -> (Ty<'tcx>, Ty<'tcx>, Ty<'tcx>) {
|
||||
let substs = tcx.intern_substs(&[pointee.into()]);
|
||||
let substs = tcx.mk_substs(&[pointee.into()]);
|
||||
let unique_ty = tcx.type_of(unique_did).subst(tcx, substs);
|
||||
let nonnull_ty = tcx.type_of(nonnull_did).subst(tcx, substs);
|
||||
let ptr_ty = tcx.mk_imm_ptr(pointee);
|
||||
|
@ -138,7 +138,7 @@ impl<'tcx> MirPass<'tcx> for ElaborateBoxDerefs {
|
|||
|
||||
if let Some(mut new_projections) = new_projections {
|
||||
new_projections.extend_from_slice(&place.projection[last_deref..]);
|
||||
place.projection = tcx.intern_place_elems(&new_projections);
|
||||
place.projection = tcx.mk_place_elems(&new_projections);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ impl<'tcx> MutVisitor<'tcx> for DerefArgVisitor<'tcx> {
|
|||
place,
|
||||
Place {
|
||||
local: SELF_ARG,
|
||||
projection: self.tcx().intern_place_elems(&[ProjectionElem::Deref]),
|
||||
projection: self.tcx().mk_place_elems(&[ProjectionElem::Deref]),
|
||||
},
|
||||
self.tcx,
|
||||
);
|
||||
|
@ -162,10 +162,9 @@ impl<'tcx> MutVisitor<'tcx> for PinArgVisitor<'tcx> {
|
|||
place,
|
||||
Place {
|
||||
local: SELF_ARG,
|
||||
projection: self.tcx().intern_place_elems(&[ProjectionElem::Field(
|
||||
Field::new(0),
|
||||
self.ref_gen_ty,
|
||||
)]),
|
||||
projection: self
|
||||
.tcx()
|
||||
.mk_place_elems(&[ProjectionElem::Field(Field::new(0), self.ref_gen_ty)]),
|
||||
},
|
||||
self.tcx,
|
||||
);
|
||||
|
@ -187,7 +186,7 @@ fn replace_base<'tcx>(place: &mut Place<'tcx>, new_base: Place<'tcx>, tcx: TyCtx
|
|||
let mut new_projection = new_base.projection.to_vec();
|
||||
new_projection.append(&mut place.projection.to_vec());
|
||||
|
||||
place.projection = tcx.intern_place_elems(&new_projection);
|
||||
place.projection = tcx.mk_place_elems(&new_projection);
|
||||
}
|
||||
|
||||
const SELF_ARG: Local = Local::from_u32(1);
|
||||
|
@ -300,7 +299,7 @@ impl<'tcx> TransformVisitor<'tcx> {
|
|||
let mut projection = base.projection.to_vec();
|
||||
projection.push(ProjectionElem::Field(Field::new(idx), ty));
|
||||
|
||||
Place { local: base.local, projection: self.tcx.intern_place_elems(&projection) }
|
||||
Place { local: base.local, projection: self.tcx.mk_place_elems(&projection) }
|
||||
}
|
||||
|
||||
// Create a statement which changes the discriminant
|
||||
|
@ -427,7 +426,7 @@ fn make_generator_state_argument_pinned<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body
|
|||
|
||||
let pin_did = tcx.require_lang_item(LangItem::Pin, Some(body.span));
|
||||
let pin_adt_ref = tcx.adt_def(pin_did);
|
||||
let substs = tcx.intern_substs(&[ref_gen_ty.into()]);
|
||||
let substs = tcx.mk_substs(&[ref_gen_ty.into()]);
|
||||
let pin_ref_gen_ty = tcx.mk_adt(pin_adt_ref, substs);
|
||||
|
||||
// Replace the by ref generator argument
|
||||
|
@ -1450,13 +1449,13 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
|
|||
// Compute Poll<return_ty>
|
||||
let poll_did = tcx.require_lang_item(LangItem::Poll, None);
|
||||
let poll_adt_ref = tcx.adt_def(poll_did);
|
||||
let poll_substs = tcx.intern_substs(&[body.return_ty().into()]);
|
||||
let poll_substs = tcx.mk_substs(&[body.return_ty().into()]);
|
||||
(poll_adt_ref, poll_substs)
|
||||
} else {
|
||||
// Compute GeneratorState<yield_ty, return_ty>
|
||||
let state_did = tcx.require_lang_item(LangItem::GeneratorState, None);
|
||||
let state_adt_ref = tcx.adt_def(state_did);
|
||||
let state_substs = tcx.intern_substs(&[yield_ty.into(), body.return_ty().into()]);
|
||||
let state_substs = tcx.mk_substs(&[yield_ty.into(), body.return_ty().into()]);
|
||||
(state_adt_ref, state_substs)
|
||||
};
|
||||
let ret_ty = tcx.mk_adt(state_adt_ref, state_substs);
|
||||
|
|
|
@ -888,7 +888,7 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
|
|||
location: Location,
|
||||
) {
|
||||
if let ProjectionElem::Field(f, ty) = elem {
|
||||
let parent = Place { local, projection: self.tcx.intern_place_elems(proj_base) };
|
||||
let parent = Place { local, projection: self.tcx.mk_place_elems(proj_base) };
|
||||
let parent_ty = parent.ty(&self.callee_body.local_decls, self.tcx);
|
||||
let check_equal = |this: &mut Self, f_ty| {
|
||||
if !util::is_equal_up_to_subtyping(this.tcx, this.param_env, ty, f_ty) {
|
||||
|
|
|
@ -121,7 +121,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> {
|
|||
|
||||
*rvalue = Rvalue::Use(Operand::Copy(Place {
|
||||
local: base.local,
|
||||
projection: self.tcx.intern_place_elems(base.projection),
|
||||
projection: self.tcx.mk_place_elems(base.projection),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ impl EnumSizeOpt {
|
|||
tcx.data_layout.ptr_sized_integer().align(&tcx.data_layout).abi,
|
||||
Mutability::Not,
|
||||
);
|
||||
let alloc = tcx.create_memory_alloc(tcx.intern_const_alloc(alloc));
|
||||
let alloc = tcx.create_memory_alloc(tcx.mk_const_alloc(alloc));
|
||||
Some((*adt_def, num_discrs, *alloc_cache.entry(ty).or_insert(alloc)))
|
||||
}
|
||||
fn optim<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
|
@ -197,9 +197,8 @@ impl EnumSizeOpt {
|
|||
size_place,
|
||||
Rvalue::Use(Operand::Copy(Place {
|
||||
local: size_array_local,
|
||||
projection: tcx.intern_place_elems(&[PlaceElem::Index(
|
||||
discr_cast_place.local,
|
||||
)]),
|
||||
projection: tcx
|
||||
.mk_place_elems(&[PlaceElem::Index(discr_cast_place.local)]),
|
||||
})),
|
||||
)),
|
||||
};
|
||||
|
|
|
@ -192,7 +192,7 @@ fn remap_mir_for_const_eval_select<'tcx>(
|
|||
let arguments = (0..num_args).map(|x| {
|
||||
let mut place_elems = place_elems.to_vec();
|
||||
place_elems.push(ProjectionElem::Field(x.into(), fields[x]));
|
||||
let projection = tcx.intern_place_elems(&place_elems);
|
||||
let projection = tcx.mk_place_elems(&place_elems);
|
||||
let place = Place {
|
||||
local: place.local,
|
||||
projection,
|
||||
|
|
|
@ -147,7 +147,7 @@ fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, ty: Option<Ty<'tcx>>)
|
|||
assert!(!matches!(ty, Some(ty) if ty.is_generator()));
|
||||
|
||||
let substs = if let Some(ty) = ty {
|
||||
tcx.intern_substs(&[ty.into()])
|
||||
tcx.mk_substs(&[ty.into()])
|
||||
} else {
|
||||
InternalSubsts::identity_for_item(tcx, def_id)
|
||||
};
|
||||
|
@ -597,7 +597,7 @@ fn build_call_shim<'tcx>(
|
|||
let untuple_args = sig.inputs();
|
||||
|
||||
// Create substitutions for the `Self` and `Args` generic parameters of the shim body.
|
||||
let arg_tup = tcx.intern_tup(untuple_args);
|
||||
let arg_tup = tcx.mk_tup(untuple_args);
|
||||
|
||||
(Some([ty.into(), arg_tup.into()]), Some(untuple_args))
|
||||
} else {
|
||||
|
@ -632,7 +632,7 @@ fn build_call_shim<'tcx>(
|
|||
Adjustment::Deref => tcx.mk_imm_ptr(fnty),
|
||||
Adjustment::RefMut => tcx.mk_mut_ptr(fnty),
|
||||
};
|
||||
sig.inputs_and_output = tcx.intern_type_list(&inputs_and_output);
|
||||
sig.inputs_and_output = tcx.mk_type_list(&inputs_and_output);
|
||||
}
|
||||
|
||||
// FIXME(eddyb) avoid having this snippet both here and in
|
||||
|
@ -643,7 +643,7 @@ fn build_call_shim<'tcx>(
|
|||
let self_arg = &mut inputs_and_output[0];
|
||||
debug_assert!(tcx.generics_of(def_id).has_self && *self_arg == tcx.types.self_param);
|
||||
*self_arg = tcx.mk_mut_ptr(*self_arg);
|
||||
sig.inputs_and_output = tcx.intern_type_list(&inputs_and_output);
|
||||
sig.inputs_and_output = tcx.mk_type_list(&inputs_and_output);
|
||||
}
|
||||
|
||||
let span = tcx.def_span(def_id);
|
||||
|
|
|
@ -122,7 +122,7 @@ impl<'tcx> ReplacementMap<'tcx> {
|
|||
let &[PlaceElem::Field(f, _), ref rest @ ..] = place.projection else { return None; };
|
||||
let fields = self.fragments[place.local].as_ref()?;
|
||||
let (_, new_local) = fields[f]?;
|
||||
Some(Place { local: new_local, projection: tcx.intern_place_elems(&rest) })
|
||||
Some(Place { local: new_local, projection: tcx.mk_place_elems(&rest) })
|
||||
}
|
||||
|
||||
fn place_fragments(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue