@@ -32,9 +32,9 @@ macro_rules! lowering_error {
3232
3333
3434fn parse_and_lower ( text : & str ) -> Result < Program > {
35- // Use the on-demand SLG solver to avoid ambiguities on projection types encountered when
36- // using the recursive solver.
37- chalk_parse:: parse_program ( text) ?. lower ( SolverChoice :: on_demand_slg ( ) )
35+ // FIXME: Use the SLG solver to avoid ambiguities on projection types encountered
36+ // when using the recursive solver.
37+ chalk_parse:: parse_program ( text) ?. lower ( SolverChoice :: slg ( ) )
3838}
3939
4040fn parse_and_lower_goal ( program : & Program , text : & str ) -> Result < Box < Goal > > {
@@ -575,7 +575,6 @@ fn ill_formed_trait_decl() {
575575 }
576576 }
577577}
578-
579578#[ test]
580579fn cyclic_traits ( ) {
581580 lowering_success ! {
@@ -587,23 +586,34 @@ fn cyclic_traits() {
587586 impl <T > A for T { }
588587 }
589588 }
590- }
591589
592- #[ test]
593- fn cyclic_traits_error ( ) {
594590 lowering_error ! {
595591 program {
596592 trait Copy { }
597593
598594 trait A where Self : B , Self : Copy { }
599595 trait B where Self : A { }
600596
597+ // This impl won't be able to prove that `T: Copy` holds.
601598 impl <T > B for T { }
599+
602600 impl <T > A for T where T : B { }
603601 } error_msg {
604602 "trait impl for \" B\" does not meet well-formedness requirements"
605603 }
606604 }
605+
606+ lowering_success ! {
607+ program {
608+ trait Copy { }
609+
610+ trait A where Self : B , Self : Copy { }
611+ trait B where Self : A { }
612+
613+ impl <T > B for T where T : Copy { }
614+ impl <T > A for T where T : B { }
615+ }
616+ }
607617}
608618
609619#[ test]
@@ -636,6 +646,7 @@ fn ill_formed_assoc_ty() {
636646 }
637647
638648 impl Bar for i32 {
649+ // `OnlyFoo<i32>` is ill-formed because `i32: Foo` does not hold.
639650 type Value = OnlyFoo <i32 >;
640651 }
641652 } error_msg {
@@ -660,6 +671,7 @@ fn implied_bounds() {
660671 }
661672
662673 impl <K > Foo for Set <K > {
674+ // Here, `WF(Set<K>)` implies `K: Hash` and hence `OnlyEq<K>` is WF.
663675 type Value = OnlyEq <K >;
664676 }
665677 }
@@ -710,6 +722,8 @@ fn wf_requiremements_for_projection() {
710722 }
711723
712724 impl <T > Foo for T {
725+ // The projection is well-formed if `T: Iterator` holds, which cannot
726+ // be proved here.
713727 type Value = <T as Iterator >:: Item ;
714728 }
715729 } error_msg {
@@ -744,6 +758,8 @@ fn projection_type_in_header() {
744758
745759 trait Bar { }
746760
761+ // Projection types in an impl header are not assumed to be well-formed,
762+ // an explicit where clause is needed (see below).
747763 impl <T > Bar for <T as Foo >:: Value { }
748764 } error_msg {
749765 "trait impl for \" Bar\" does not meet well-formedness requirements"
0 commit comments