File tree Expand file tree Collapse file tree
compiler/rustc_type_ir/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -400,7 +400,15 @@ pub trait GenericArg<I: Interner<GenericArg = Self>>:
400400
401401#[ rust_analyzer:: prefer_underscore_import]
402402pub 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 } )
You can’t perform that action at this time.
0 commit comments