File tree Expand file tree Collapse file tree 2 files changed +72
-1
lines changed Expand file tree Collapse file tree 2 files changed +72
-1
lines changed Original file line number Diff line number Diff line change @@ -323,7 +323,7 @@ impl WfSolver {
323323 let goal = Goal :: Implies ( hypotheses, Box :: new ( goal) )
324324 . quantify ( QuantifierKind :: ForAll , impl_datum. binders . binders . clone ( ) ) ;
325325
326- println ! ( "{:?}" , goal) ;
326+ debug ! ( "WF trait goal: {:?}" , goal) ;
327327
328328 match self . solver_choice . solve_root_goal ( & self . env , & goal. into_closed_goal ( ) ) . unwrap ( ) {
329329 Some ( sol) => sol. is_unique ( ) ,
Original file line number Diff line number Diff line change @@ -669,6 +669,77 @@ fn normalize_gat_with_where_clause() {
669669 }
670670}
671671
672+ #[ test]
673+ fn normalize_gat_with_where_clause2 ( ) {
674+ test ! {
675+ program {
676+ trait Bar <T > { }
677+ trait Foo <T > {
678+ type Item <U > where U : Bar <T >;
679+ }
680+
681+ struct Value <T > { }
682+ struct Sometype { }
683+ impl <T > Foo <T > for Sometype {
684+ type Item <U > = Value <U >;
685+ }
686+ }
687+
688+ goal {
689+ forall<T , U > {
690+ exists<V > {
691+ Normalize ( <Sometype as Foo <T >>:: Item <U > -> V )
692+ }
693+ }
694+ } yields {
695+ "No possible solution"
696+ }
697+
698+ goal {
699+ forall<T , U > {
700+ exists<V > {
701+ if ( U : Bar <T >) {
702+ Normalize ( <Sometype as Foo <T >>:: Item <U > -> V )
703+ }
704+ }
705+ }
706+ } yields {
707+ "Unique; substitution [?0 := Value<!2>]"
708+ }
709+ }
710+ }
711+
712+ #[ test]
713+ fn normalize_gat_with_higher_ranked_trait_bound ( ) {
714+ test ! {
715+ program {
716+ trait Foo <' a, T > { }
717+ struct i32 { }
718+
719+ trait Bar <' a, T > {
720+ type Item <V >: Foo <' a, T > where V : Foo <' a, T >;
721+ }
722+
723+ impl <' a, T > Foo <' a, T > for i32 { }
724+ impl <' a, T > Bar <' a, T > for i32 {
725+ type Item <V > = i32 ;
726+ }
727+ }
728+
729+ goal {
730+ forall<' a, T , V > {
731+ if ( forall<' b> { V : Foo <' b, T > } ) {
732+ exists<U > {
733+ Normalize ( <i32 as Bar <' a, T >>:: Item <V > -> U )
734+ }
735+ }
736+ }
737+ } yields {
738+ "Unique; substitution [?0 := i32], lifetime constraints []"
739+ }
740+ }
741+ }
742+
672743#[ test]
673744fn normalize_implied_bound ( ) {
674745 test ! {
You can’t perform that action at this time.
0 commit comments