@@ -579,6 +579,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
579579 }
580580
581581 let mut restrict_type_params = false ;
582+ let mut unsatisfied_bounds = false ;
582583 if !unsatisfied_predicates. is_empty ( ) {
583584 let def_span = |def_id| {
584585 self . tcx . sess . source_map ( ) . guess_head_span ( self . tcx . def_span ( def_id) )
@@ -739,6 +740,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
739740 err. note ( & format ! (
740741 "the following trait bounds were not satisfied:\n {bound_list}"
741742 ) ) ;
743+ unsatisfied_bounds = true ;
742744 }
743745 }
744746
@@ -752,6 +754,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
752754 source,
753755 out_of_scope_traits,
754756 & unsatisfied_predicates,
757+ unsatisfied_bounds,
755758 ) ;
756759 }
757760
@@ -984,9 +987,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
984987 source : SelfSource < ' tcx > ,
985988 valid_out_of_scope_traits : Vec < DefId > ,
986989 unsatisfied_predicates : & [ ( ty:: Predicate < ' tcx > , Option < ty:: Predicate < ' tcx > > ) ] ,
990+ unsatisfied_bounds : bool ,
987991 ) {
988992 let mut alt_rcvr_sugg = false ;
989- if let SelfSource :: MethodCall ( rcvr) = source {
993+ if let ( SelfSource :: MethodCall ( rcvr) , false ) = ( source, unsatisfied_bounds ) {
990994 debug ! ( ?span, ?item_name, ?rcvr_ty, ?rcvr) ;
991995 let skippable = [
992996 self . tcx . lang_items ( ) . clone_trait ( ) ,
0 commit comments