Skip to content

Commit b9daf6b

Browse files
committed
as_type_outlives_clause
1 parent 6d63368 commit b9daf6b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

compiler/rustc_type_ir/src/inherent.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,18 @@ pub trait Clause<I: Interner<Clause = Self>>:
563563
{
564564
fn as_predicate(self) -> I::Predicate;
565565

566+
fn as_type_outlives_clause(self) -> Option<ty::Binder<I, ty::OutlivesPredicate<I, I::Ty>>> {
567+
self.kind()
568+
.map_bound(|clause| {
569+
if let ty::ClauseKind::TypeOutlives(outlives) = clause {
570+
Some(outlives)
571+
} else {
572+
None
573+
}
574+
})
575+
.transpose()
576+
}
577+
566578
fn as_trait_clause(self) -> Option<ty::Binder<I, ty::TraitPredicate<I>>> {
567579
self.kind()
568580
.map_bound(|clause| if let ty::ClauseKind::Trait(t) = clause { Some(t) } else { None })

0 commit comments

Comments
 (0)