@@ -764,7 +764,37 @@ fn match_ty<I: Interner>(
764
764
builder. push_fact ( WellFormed :: Ty ( ty. clone ( ) ) ) ;
765
765
}
766
766
TyKind :: BoundVar ( _) | TyKind :: InferenceVar ( _, _) => return Err ( Floundered ) ,
767
- TyKind :: Dyn ( _) => { }
767
+ TyKind :: Dyn ( dyn_ty) => {
768
+ // FIXME(#203)
769
+ // - Object safety? (not needed with RFC 2027)
770
+ // - Implied bounds
771
+ // - Bounds on the associated types
772
+ // - Checking that all associated types are specified, including
773
+ // those on supertraits.
774
+ // - For trait objects with GATs, check that the bounds are fully
775
+ // general (`dyn for<'a> StreamingIterator<Item<'a> = &'a ()>` is OK,
776
+ // `dyn StreamingIterator<Item<'static> = &'static ()>` is not).
777
+ let bounds = dyn_ty
778
+ . bounds
779
+ . substitute ( interner, & [ ty. clone ( ) . cast :: < GenericArg < I > > ( interner) ] ) ;
780
+
781
+ let mut wf_goals = Vec :: new ( ) ;
782
+
783
+ wf_goals. extend ( bounds. iter ( interner) . flat_map ( |bound| {
784
+ bound. map_ref ( |bound| -> Vec < _ > {
785
+ match bound {
786
+ WhereClause :: Implemented ( trait_ref) => {
787
+ vec ! [ DomainGoal :: WellFormed ( WellFormed :: Trait ( trait_ref. clone( ) ) ) ]
788
+ }
789
+ WhereClause :: AliasEq ( _)
790
+ | WhereClause :: LifetimeOutlives ( _)
791
+ | WhereClause :: TypeOutlives ( _) => vec ! [ ] ,
792
+ }
793
+ } )
794
+ } ) ) ;
795
+
796
+ builder. push_clause ( WellFormed :: Ty ( ty. clone ( ) ) , wf_goals) ;
797
+ }
768
798
} )
769
799
}
770
800
0 commit comments