File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -557,3 +557,58 @@ fn builtin_impl_enumeration() {
557
557
}
558
558
}
559
559
}
560
+
561
+ /// Don't return definite guidance if we flounder after finding one solution.
562
+ #[ test]
563
+ fn flounder_ambiguous ( ) {
564
+ test ! {
565
+ program {
566
+ trait IntoIterator { }
567
+ #[ non_enumerable]
568
+ trait OtherTrait { }
569
+
570
+ struct Ref <T > { }
571
+ struct A { }
572
+
573
+ impl IntoIterator for Ref <A > { }
574
+ impl <T > IntoIterator for Ref <T > where T : OtherTrait { }
575
+ }
576
+
577
+ goal {
578
+ exists<T > { Ref <T >: IntoIterator }
579
+ } yields {
580
+ "Ambiguous; no inference guidance"
581
+ }
582
+ }
583
+ }
584
+
585
+ /// Don't return definite guidance if we are able to merge two solutions and the
586
+ /// third one matches that as well (the fourth may not).
587
+ #[ test]
588
+ fn normalize_ambiguous ( ) {
589
+ test ! {
590
+ program {
591
+ trait IntoIterator { type Item ; }
592
+
593
+ struct Ref <T > { }
594
+ struct A { }
595
+ struct B { }
596
+ struct C { }
597
+
598
+ struct D { }
599
+
600
+ impl IntoIterator for Ref <A > { type Item = Ref <A >; }
601
+ impl IntoIterator for Ref <B > { type Item = Ref <B >; }
602
+ impl IntoIterator for Ref <C > { type Item = Ref <C >; }
603
+ impl IntoIterator for Ref <D > { type Item = D ; }
604
+ }
605
+
606
+ goal {
607
+ exists<T , U > {
608
+ Normalize ( <Ref <T > as IntoIterator >:: Item -> U )
609
+ }
610
+ } yields {
611
+ "Ambiguous; no inference guidance"
612
+ }
613
+ }
614
+ }
You can’t perform that action at this time.
0 commit comments