Skip to content

Commit 90e6c79

Browse files
BoxyUwUlcnr
authored andcommitted
rewrite region constraints to smaller universes
1 parent ab698c3 commit 90e6c79

5 files changed

Lines changed: 810 additions & 12 deletions

File tree

compiler/rustc_middle/src/ty/list.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,17 @@ impl<'a, H, T: Copy> rustc_type_ir::inherent::SliceLike for &'a RawList<H, T> {
153153
}
154154
}
155155

156+
impl<'tcx> rustc_type_ir::inherent::BoundVarKinds<TyCtxt<'tcx>>
157+
for &'tcx RawList<(), crate::ty::BoundVariableKind<'tcx>>
158+
{
159+
fn from_vars(
160+
tcx: TyCtxt<'tcx>,
161+
iter: impl IntoIterator<Item = crate::ty::BoundVariableKind<'tcx>>,
162+
) -> Self {
163+
tcx.mk_bound_variable_kinds_from_iter(iter.into_iter())
164+
}
165+
}
166+
156167
macro_rules! impl_list_empty {
157168
($header_ty:ty, $header_init:expr) => {
158169
impl<T> RawList<$header_ty, T> {

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,12 +1863,11 @@ where
18631863
.map(|u| UniverseIndex::from_usize(u))
18641864
.rev()
18651865
.fold(constraint, |constraint, u| {
1866-
// rustc_type_ir::region_constraint::eagerly_handle_placeholders_in_universe(
1867-
// &**self.delegate,
1868-
// constraint,
1869-
// u,
1870-
// )
1871-
todo!() as RegionConstraint::<I>
1866+
rustc_type_ir::region_constraint::eagerly_handle_placeholders_in_universe(
1867+
&**self.delegate,
1868+
constraint,
1869+
u,
1870+
)
18721871
});
18731872

18741873
if constraint.is_false() {

compiler/rustc_type_ir/src/inherent.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,12 @@ pub trait OpaqueTypeStorageEntries: Debug + Copy + Default {
702702
fn needs_reevaluation(self, canonicalized: usize) -> bool;
703703
}
704704

705+
pub trait BoundVarKinds<I: Interner>:
706+
Copy + Debug + Hash + Eq + SliceLike<Item = ty::BoundVariableKind<I>> + Default
707+
{
708+
fn from_vars(cx: I, iter: impl IntoIterator<Item = ty::BoundVariableKind<I>>) -> Self;
709+
}
710+
705711
pub trait SliceLike: Sized + Copy {
706712
type Item: Copy;
707713
type IntoIter: Iterator<Item = Self::Item> + DoubleEndedIterator;

compiler/rustc_type_ir/src/interner.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,7 @@ pub trait Interner:
9696
type GenericArg: GenericArg<Self>;
9797
type Term: Term<Self>;
9898

99-
type BoundVarKinds: Copy
100-
+ Debug
101-
+ Hash
102-
+ Eq
103-
+ SliceLike<Item = ty::BoundVariableKind<Self>>
104-
+ Default;
99+
type BoundVarKinds: BoundVarKinds<Self>;
105100

106101
type PredefinedOpaques: Copy
107102
+ Debug

0 commit comments

Comments
 (0)