Skip to content

Commit 8e8c7e5

Browse files
committed
rewrite region constraints to smaller universes
1 parent f366f5c commit 8e8c7e5

2 files changed

Lines changed: 1006 additions & 1 deletion

File tree

compiler/rustc_type_ir/src/inherent.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,15 @@ pub trait GenericArg<I: Interner<GenericArg = Self>>:
400400

401401
#[rust_analyzer::prefer_underscore_import]
402402
pub trait Term<I: Interner<Term = Self>>:
403-
Copy + Debug + Hash + Eq + IntoKind<Kind = ty::TermKind<I>> + TypeFoldable<I> + Relate<I>
403+
Copy
404+
+ Debug
405+
+ Hash
406+
+ Eq
407+
+ IntoKind<Kind = ty::TermKind<I>>
408+
+ TypeFoldable<I>
409+
+ Relate<I>
410+
+ From<I::Ty>
411+
+ From<I::Const>
404412
{
405413
fn as_type(&self) -> Option<I::Ty> {
406414
if let ty::TermKind::Ty(ty) = self.kind() { Some(ty) } else { None }
@@ -563,6 +571,18 @@ pub trait Clause<I: Interner<Clause = Self>>:
563571
{
564572
fn as_predicate(self) -> I::Predicate;
565573

574+
fn as_type_outlives_clause(self) -> Option<ty::Binder<I, ty::OutlivesPredicate<I, I::Ty>>> {
575+
self.kind()
576+
.map_bound(|clause| {
577+
if let ty::ClauseKind::TypeOutlives(outlives) = clause {
578+
Some(outlives)
579+
} else {
580+
None
581+
}
582+
})
583+
.transpose()
584+
}
585+
566586
fn as_trait_clause(self) -> Option<ty::Binder<I, ty::TraitPredicate<I>>> {
567587
self.kind()
568588
.map_bound(|clause| if let ty::ClauseKind::Trait(t) = clause { Some(t) } else { None })

0 commit comments

Comments
 (0)