@@ -359,7 +359,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
359
359
}
360
360
& Ok ( None ) => { }
361
361
& Err ( SelectionError :: Unimplemented ) => {
362
- if self . is_of_param ( pred. skip_binder ( ) . self_ty ( ) ) {
362
+ if self . is_param_no_infer ( pred. skip_binder ( ) . trait_ref . substs ) {
363
363
already_visited. remove ( & pred) ;
364
364
self . add_user_pred (
365
365
& mut user_computed_preds,
@@ -597,6 +597,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
597
597
finished_map
598
598
}
599
599
600
+ fn is_param_no_infer ( & self , substs : & Substs < ' _ > ) -> bool {
601
+ return self . is_of_param ( substs. type_at ( 0 ) ) &&
602
+ !substs. types ( ) . any ( |t| t. has_infer_types ( ) ) ;
603
+ }
604
+
600
605
pub fn is_of_param ( & self , ty : Ty < ' _ > ) -> bool {
601
606
return match ty. sty {
602
607
ty:: Param ( _) => true ,
@@ -646,7 +651,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
646
651
// from the various possible predicates
647
652
match & predicate {
648
653
& ty:: Predicate :: Trait ( ref p) => {
649
- if self . is_of_param ( p. skip_binder ( ) . self_ty ( ) )
654
+ if self . is_param_no_infer ( p. skip_binder ( ) . trait_ref . substs )
650
655
&& !only_projections
651
656
&& is_new_pred {
652
657
@@ -663,7 +668,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
663
668
// an inference variable.
664
669
// Additionally, we check if we've seen this predicate before,
665
670
// to avoid rendering duplicate bounds to the user.
666
- if self . is_of_param ( p. skip_binder ( ) . projection_ty . self_ty ( ) )
671
+ if self . is_param_no_infer ( p. skip_binder ( ) . projection_ty . substs )
667
672
&& !p. ty ( ) . skip_binder ( ) . is_ty_infer ( )
668
673
&& is_new_pred {
669
674
debug ! ( "evaluate_nested_obligations: adding projection predicate\
0 commit comments