@@ -374,7 +374,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
374374 }
375375 & Ok ( None ) => { }
376376 & 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 ) {
378378 already_visited. remove ( & pred) ;
379379 self . add_user_pred (
380380 & mut user_computed_preds,
@@ -636,6 +636,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
636636 finished_map
637637 }
638638
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+
639644 pub fn is_of_param ( & self , ty : Ty < ' _ > ) -> bool {
640645 return match ty. sty {
641646 ty:: Param ( _) => true ,
@@ -685,7 +690,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
685690 // from the various possible predicates
686691 match & predicate {
687692 & 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 )
689694 && !only_projections
690695 && is_new_pred {
691696
@@ -702,7 +707,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
702707 // an inference variable.
703708 // Additionally, we check if we've seen this predicate before,
704709 // 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 )
706711 && !p. ty ( ) . skip_binder ( ) . is_ty_infer ( )
707712 && is_new_pred {
708713 debug ! ( "evaluate_nested_obligations: adding projection predicate\
0 commit comments