@@ -374,7 +374,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
374
374
}
375
375
& Ok ( None ) => { }
376
376
& Err ( SelectionError :: Unimplemented ) => {
377
- if self . is_of_param ( pred. skip_binder ( ) . self_ty ( ) ) {
377
+ if self . is_param_no_infer ( pred. skip_binder ( ) . trait_ref . substs ) {
378
378
already_visited. remove ( & pred) ;
379
379
self . add_user_pred (
380
380
& mut user_computed_preds,
@@ -636,6 +636,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
636
636
finished_map
637
637
}
638
638
639
+ fn is_param_no_infer ( & self , substs : & Substs < ' _ > ) -> bool {
640
+ return self . is_of_param ( substs. type_at ( 0 ) ) &&
641
+ !substs. types ( ) . any ( |t| t. has_infer_types ( ) ) ;
642
+ }
643
+
639
644
pub fn is_of_param ( & self , ty : Ty < ' _ > ) -> bool {
640
645
return match ty. sty {
641
646
ty:: Param ( _) => true ,
@@ -685,7 +690,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
685
690
// from the various possible predicates
686
691
match & predicate {
687
692
& ty:: Predicate :: Trait ( ref p) => {
688
- if self . is_of_param ( p. skip_binder ( ) . self_ty ( ) )
693
+ if self . is_param_no_infer ( p. skip_binder ( ) . trait_ref . substs )
689
694
&& !only_projections
690
695
&& is_new_pred {
691
696
@@ -702,7 +707,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
702
707
// an inference variable.
703
708
// Additionally, we check if we've seen this predicate before,
704
709
// to avoid rendering duplicate bounds to the user.
705
- if self . is_of_param ( p. skip_binder ( ) . projection_ty . self_ty ( ) )
710
+ if self . is_param_no_infer ( p. skip_binder ( ) . projection_ty . substs )
706
711
&& !p. ty ( ) . skip_binder ( ) . is_ty_infer ( )
707
712
&& is_new_pred {
708
713
debug ! ( "evaluate_nested_obligations: adding projection predicate\
0 commit comments