Skip to content

Commit 825a7cc

Browse files
committed
make PlaceholderConst not store the type of the const
1 parent 1f5d8d4 commit 825a7cc

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
511511
}
512512
ty::ConstKind::Placeholder(placeholder) => {
513513
return self.canonicalize_const_var(
514-
CanonicalVarInfo { kind: CanonicalVarKind::PlaceholderConst(placeholder) },
514+
CanonicalVarInfo { kind: CanonicalVarKind::PlaceholderConst(placeholder, ct.ty()) },
515515
ct,
516516
);
517517
}
@@ -695,11 +695,11 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
695695
..placeholder
696696
})
697697
}
698-
CanonicalVarKind::PlaceholderConst(placeholder) => {
698+
CanonicalVarKind::PlaceholderConst(placeholder, t) => {
699699
CanonicalVarKind::PlaceholderConst(ty::Placeholder {
700700
universe: reverse_universe_map[&placeholder.universe],
701701
..placeholder
702-
})
702+
}, t)
703703
}
704704
},
705705
})

compiler/rustc_infer/src/infer/canonical/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
144144
)
145145
.into(),
146146

147-
CanonicalVarKind::PlaceholderConst(ty::PlaceholderConst { universe, name }) => {
147+
CanonicalVarKind::PlaceholderConst(ty::PlaceholderConst { universe, name }, ty) => {
148148
let universe_mapped = universe_map(universe);
149149
let placeholder_mapped = ty::PlaceholderConst { universe: universe_mapped, name };
150150
self.tcx
151151
.mk_const(ty::ConstS {
152152
kind: ty::ConstKind::Placeholder(placeholder_mapped),
153-
ty: name.ty,
153+
ty,
154154
})
155155
.into()
156156
}

compiler/rustc_infer/src/infer/higher_ranked/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
9797
self.tcx.mk_const(ty::ConstS {
9898
kind: ty::ConstKind::Placeholder(ty::PlaceholderConst {
9999
universe: next_universe,
100-
name: ty::BoundConst { var: bound_var, ty },
100+
name: bound_var,
101101
}),
102102
ty,
103103
})

compiler/rustc_infer/src/infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,7 @@ fn replace_param_and_infer_substs_with_placeholder<'tcx>(
20692069
ty,
20702070
kind: ty::ConstKind::Placeholder(ty::PlaceholderConst {
20712071
universe: ty::UniverseIndex::ROOT,
2072-
name: ty::BoundConst { ty, var: ty::BoundVar::from_usize(idx) },
2072+
name: ty::BoundVar::from_usize(idx),
20732073
}),
20742074
})
20752075
.into()

compiler/rustc_middle/src/infer/canonical.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'tcx> CanonicalVarInfo<'tcx> {
105105
CanonicalVarKind::Region(_) => true,
106106
CanonicalVarKind::PlaceholderRegion(..) => false,
107107
CanonicalVarKind::Const(..) => true,
108-
CanonicalVarKind::PlaceholderConst(_) => false,
108+
CanonicalVarKind::PlaceholderConst(_, _) => false,
109109
}
110110
}
111111
}
@@ -133,7 +133,7 @@ pub enum CanonicalVarKind<'tcx> {
133133
Const(ty::UniverseIndex, Ty<'tcx>),
134134

135135
/// A "placeholder" that represents "any const".
136-
PlaceholderConst(ty::PlaceholderConst<'tcx>),
136+
PlaceholderConst(ty::PlaceholderConst<'tcx>, Ty<'tcx>),
137137
}
138138

139139
impl<'tcx> CanonicalVarKind<'tcx> {
@@ -148,7 +148,7 @@ impl<'tcx> CanonicalVarKind<'tcx> {
148148
CanonicalVarKind::Region(ui) => ui,
149149
CanonicalVarKind::PlaceholderRegion(placeholder) => placeholder.universe,
150150
CanonicalVarKind::Const(ui, _) => ui,
151-
CanonicalVarKind::PlaceholderConst(placeholder) => placeholder.universe,
151+
CanonicalVarKind::PlaceholderConst(placeholder, _) => placeholder.universe,
152152
}
153153
}
154154
}

compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ pub struct BoundConst<'tcx> {
12001200
pub ty: Ty<'tcx>,
12011201
}
12021202

1203-
pub type PlaceholderConst<'tcx> = Placeholder<BoundConst<'tcx>>;
1203+
pub type PlaceholderConst<'tcx> = Placeholder<BoundVar>;
12041204

12051205
/// A `DefId` which, in case it is a const argument, is potentially bundled with
12061206
/// the `DefId` of the generic parameter it instantiates.

compiler/rustc_trait_selection/src/traits/project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ impl<'tcx> TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
746746
let universe = self.universe_for(debruijn);
747747
let p = ty::PlaceholderConst {
748748
universe,
749-
name: ty::BoundConst { var: bound_const, ty: ct.ty() },
749+
name: bound_const,
750750
};
751751
self.mapped_consts.insert(p, bound_const);
752752
self.infcx

compiler/rustc_traits/src/chalk/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub(crate) fn evaluate_goal<'tcx>(
7676
chalk_ir::UniverseIndex { counter: ui.index() },
7777
),
7878
CanonicalVarKind::Const(_ui, _ty) => unimplemented!(),
79-
CanonicalVarKind::PlaceholderConst(_pc) => unimplemented!(),
79+
CanonicalVarKind::PlaceholderConst(_pc, _ty) => unimplemented!(),
8080
}),
8181
),
8282
value: obligation.value.lower_into(interner),

0 commit comments

Comments
 (0)