@@ -32,9 +32,9 @@ macro_rules! lowering_error {
32
32
33
33
34
34
fn 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 ( ) )
38
38
}
39
39
40
40
fn parse_and_lower_goal ( program : & Program , text : & str ) -> Result < Box < Goal > > {
@@ -575,7 +575,6 @@ fn ill_formed_trait_decl() {
575
575
}
576
576
}
577
577
}
578
-
579
578
#[ test]
580
579
fn cyclic_traits ( ) {
581
580
lowering_success ! {
@@ -587,23 +586,34 @@ fn cyclic_traits() {
587
586
impl <T > A for T { }
588
587
}
589
588
}
590
- }
591
589
592
- #[ test]
593
- fn cyclic_traits_error ( ) {
594
590
lowering_error ! {
595
591
program {
596
592
trait Copy { }
597
593
598
594
trait A where Self : B , Self : Copy { }
599
595
trait B where Self : A { }
600
596
597
+ // This impl won't be able to prove that `T: Copy` holds.
601
598
impl <T > B for T { }
599
+
602
600
impl <T > A for T where T : B { }
603
601
} error_msg {
604
602
"trait impl for \" B\" does not meet well-formedness requirements"
605
603
}
606
604
}
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
+ }
607
617
}
608
618
609
619
#[ test]
@@ -636,6 +646,7 @@ fn ill_formed_assoc_ty() {
636
646
}
637
647
638
648
impl Bar for i32 {
649
+ // `OnlyFoo<i32>` is ill-formed because `i32: Foo` does not hold.
639
650
type Value = OnlyFoo <i32 >;
640
651
}
641
652
} error_msg {
@@ -660,6 +671,7 @@ fn implied_bounds() {
660
671
}
661
672
662
673
impl <K > Foo for Set <K > {
674
+ // Here, `WF(Set<K>)` implies `K: Hash` and hence `OnlyEq<K>` is WF.
663
675
type Value = OnlyEq <K >;
664
676
}
665
677
}
@@ -710,6 +722,8 @@ fn wf_requiremements_for_projection() {
710
722
}
711
723
712
724
impl <T > Foo for T {
725
+ // The projection is well-formed if `T: Iterator` holds, which cannot
726
+ // be proved here.
713
727
type Value = <T as Iterator >:: Item ;
714
728
}
715
729
} error_msg {
@@ -744,6 +758,8 @@ fn projection_type_in_header() {
744
758
745
759
trait Bar { }
746
760
761
+ // Projection types in an impl header are not assumed to be well-formed,
762
+ // an explicit where clause is needed (see below).
747
763
impl <T > Bar for <T as Foo >:: Value { }
748
764
} error_msg {
749
765
"trait impl for \" Bar\" does not meet well-formedness requirements"
0 commit comments