Part 2 refactoring of moving placeholder types to rustc_type_ir

This commit is contained in:
James Barford-Evans 2025-12-22 14:45:08 +00:00
parent fb292b75fb
commit 25c1365507
52 changed files with 610 additions and 546 deletions

View file

@ -684,19 +684,19 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
CanonicalVarKind::Region(u) => CanonicalVarKind::Region(reverse_universe_map[&u]),
CanonicalVarKind::Const(u) => CanonicalVarKind::Const(reverse_universe_map[&u]),
CanonicalVarKind::PlaceholderTy(placeholder) => {
CanonicalVarKind::PlaceholderTy(ty::Placeholder::new(
CanonicalVarKind::PlaceholderTy(ty::PlaceholderType::new(
reverse_universe_map[&placeholder.universe],
placeholder.bound,
))
}
CanonicalVarKind::PlaceholderRegion(placeholder) => {
CanonicalVarKind::PlaceholderRegion(ty::Placeholder::new(
CanonicalVarKind::PlaceholderRegion(ty::PlaceholderRegion::new(
reverse_universe_map[&placeholder.universe],
placeholder.bound,
))
}
CanonicalVarKind::PlaceholderConst(placeholder) => {
CanonicalVarKind::PlaceholderConst(ty::Placeholder::new(
CanonicalVarKind::PlaceholderConst(ty::PlaceholderConst::new(
reverse_universe_map[&placeholder.universe],
placeholder.bound,
))

View file

@ -447,7 +447,7 @@ pub enum RegionVariableOrigin<'tcx> {
/// Region variables created when instantiating a binder with
/// existential variables, e.g. when calling a function or method.
BoundRegion(Span, ty::BoundRegionKind, BoundRegionConversionTime),
BoundRegion(Span, ty::BoundRegionKind<'tcx>, BoundRegionConversionTime),
UpvarRegion(ty::UpvarId, Span),
@ -1300,13 +1300,13 @@ impl<'tcx> InferCtxt<'tcx> {
}
impl<'tcx> BoundVarReplacerDelegate<'tcx> for ToFreshVars<'tcx> {
fn replace_region(&mut self, br: ty::BoundRegion) -> ty::Region<'tcx> {
fn replace_region(&mut self, br: ty::BoundRegion<'tcx>) -> ty::Region<'tcx> {
self.args[br.var.index()].expect_region()
}
fn replace_ty(&mut self, bt: ty::BoundTy) -> Ty<'tcx> {
fn replace_ty(&mut self, bt: ty::BoundTy<'tcx>) -> Ty<'tcx> {
self.args[bt.var.index()].expect_ty()
}
fn replace_const(&mut self, bc: ty::BoundConst) -> ty::Const<'tcx> {
fn replace_const(&mut self, bc: ty::BoundConst<'tcx>) -> ty::Const<'tcx> {
self.args[bc.var.index()].expect_const()
}
}

View file

@ -91,7 +91,7 @@ pub(super) fn can_match_erased_ty<'tcx>(
struct MatchAgainstHigherRankedOutlives<'tcx> {
tcx: TyCtxt<'tcx>,
pattern_depth: ty::DebruijnIndex,
map: FxHashMap<ty::BoundRegion, ty::Region<'tcx>>,
map: FxHashMap<ty::BoundRegion<'tcx>, ty::Region<'tcx>>,
}
impl<'tcx> MatchAgainstHigherRankedOutlives<'tcx> {
@ -115,7 +115,7 @@ impl<'tcx> MatchAgainstHigherRankedOutlives<'tcx> {
#[instrument(level = "trace", skip(self))]
fn bind(
&mut self,
br: ty::BoundRegion,
br: ty::BoundRegion<'tcx>,
value: ty::Region<'tcx>,
) -> RelateResult<'tcx, ty::Region<'tcx>> {
match self.map.entry(br) {

View file

@ -33,13 +33,13 @@ impl<'tcx> InferCtxt<'tcx> {
let next_universe = self.create_next_universe();
let delegate = FnMutDelegate {
regions: &mut |br: ty::BoundRegion| {
regions: &mut |br: ty::BoundRegion<'tcx>| {
ty::Region::new_placeholder(self.tcx, ty::PlaceholderRegion::new(next_universe, br))
},
types: &mut |bound_ty: ty::BoundTy| {
types: &mut |bound_ty: ty::BoundTy<'tcx>| {
Ty::new_placeholder(self.tcx, ty::PlaceholderType::new(next_universe, bound_ty))
},
consts: &mut |bound_const: ty::BoundConst| {
consts: &mut |bound_const: ty::BoundConst<'tcx>| {
ty::Const::new_placeholder(
self.tcx,
ty::PlaceholderConst::new(next_universe, bound_const),