@@ -38,13 +38,14 @@ use rustc_trait_selection::error_reporting::traits::on_unimplemented::OnUnimplem
3838use rustc_trait_selection:: infer:: InferCtxtExt ;
3939use rustc_trait_selection:: traits:: query:: evaluate_obligation:: InferCtxtExt as _;
4040use rustc_trait_selection:: traits:: {
41- FulfillmentError , Obligation , ObligationCause , ObligationCauseCode , supertraits,
41+ FulfillmentError , Obligation , ObligationCauseCode , supertraits,
4242} ;
4343use tracing:: { debug, info, instrument} ;
4444
4545use super :: probe:: { AutorefOrPtrAdjustment , IsSuggestion , Mode , ProbeScope } ;
4646use super :: { CandidateSource , MethodError , NoMatchData } ;
4747use crate :: errors:: { self , CandidateTraitNote , NoAssociatedItem } ;
48+ use crate :: method:: probe:: UnsatisfiedPredicate ;
4849use crate :: { Expectation , FnCtxt } ;
4950
5051impl < ' a , ' tcx > FnCtxt < ' a , ' tcx > {
@@ -58,11 +59,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
5859 & self ,
5960 ty : Ty < ' tcx > ,
6061 span : Span ,
61- unsatisfied_predicates : & Vec < (
62- ty:: Predicate < ' tcx > ,
63- Option < ty:: Predicate < ' tcx > > ,
64- Option < ObligationCause < ' tcx > > ,
65- ) > ,
62+ unsatisfied_predicates : & Vec < UnsatisfiedPredicate < ' tcx > > ,
6663 ) -> bool {
6764 fn predicate_bounds_generic_param < ' tcx > (
6865 predicate : ty:: Predicate < ' _ > ,
@@ -410,11 +407,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
410407 source : SelfSource < ' tcx > ,
411408 is_method : bool ,
412409 sugg_span : Span ,
413- unsatisfied_predicates : & Vec < (
414- ty:: Predicate < ' tcx > ,
415- Option < ty:: Predicate < ' tcx > > ,
416- Option < ObligationCause < ' tcx > > ,
417- ) > ,
410+ unsatisfied_predicates : & Vec < UnsatisfiedPredicate < ' tcx > > ,
418411 ) -> Diag < ' _ > {
419412 // Don't show expanded generic arguments when the method can't be found in any
420413 // implementation (#81576).
@@ -1096,11 +1089,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10961089 mode : Mode ,
10971090 source : SelfSource < ' tcx > ,
10981091 span : Span ,
1099- unsatisfied_predicates : & Vec < (
1100- ty:: Predicate < ' tcx > ,
1101- Option < ty:: Predicate < ' tcx > > ,
1102- Option < ObligationCause < ' tcx > > ,
1103- ) > ,
1092+ unsatisfied_predicates : & Vec < UnsatisfiedPredicate < ' tcx > > ,
11041093 find_candidate_for_method : & mut bool ,
11051094 ) {
11061095 let ty_str = self . tcx . short_string ( rcvr_ty, err. long_ty_path ( ) ) ;
@@ -1198,11 +1187,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11981187 item_ident : Ident ,
11991188 span : Span ,
12001189 source : SelfSource < ' tcx > ,
1201- unsatisfied_predicates : & Vec < (
1202- ty:: Predicate < ' tcx > ,
1203- Option < ty:: Predicate < ' tcx > > ,
1204- Option < ObligationCause < ' tcx > > ,
1205- ) > ,
1190+ unsatisfied_predicates : & Vec < UnsatisfiedPredicate < ' tcx > > ,
12061191 ) {
12071192 // Don't emit a suggestion if we found an actual method that had unsatisfied trait bounds
12081193 if !unsatisfied_predicates. is_empty ( ) || !rcvr_ty. is_enum ( ) {
@@ -1338,11 +1323,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13381323 item_ident : Ident ,
13391324 item_kind : & str ,
13401325 span : Span ,
1341- unsatisfied_predicates : & Vec < (
1342- ty:: Predicate < ' tcx > ,
1343- Option < ty:: Predicate < ' tcx > > ,
1344- Option < ObligationCause < ' tcx > > ,
1345- ) > ,
1326+ unsatisfied_predicates : & Vec < UnsatisfiedPredicate < ' tcx > > ,
13461327 restrict_type_params : & mut bool ,
13471328 suggested_derive : & mut bool ,
13481329 unsatisfied_bounds : & mut bool ,
@@ -3122,11 +3103,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
31223103 fn note_predicate_source_and_get_derives (
31233104 & self ,
31243105 err : & mut Diag < ' _ > ,
3125- unsatisfied_predicates : & [ (
3126- ty:: Predicate < ' tcx > ,
3127- Option < ty:: Predicate < ' tcx > > ,
3128- Option < ObligationCause < ' tcx > > ,
3129- ) ] ,
3106+ unsatisfied_predicates : & [ UnsatisfiedPredicate < ' tcx > ] ,
31303107 ) -> Vec < ( String , Span , Symbol ) > {
31313108 let mut derives = Vec :: < ( String , Span , Symbol ) > :: new ( ) ;
31323109 let mut traits = Vec :: new ( ) ;
@@ -3204,11 +3181,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
32043181 pub ( crate ) fn suggest_derive (
32053182 & self ,
32063183 err : & mut Diag < ' _ > ,
3207- unsatisfied_predicates : & [ (
3208- ty:: Predicate < ' tcx > ,
3209- Option < ty:: Predicate < ' tcx > > ,
3210- Option < ObligationCause < ' tcx > > ,
3211- ) ] ,
3184+ unsatisfied_predicates : & [ UnsatisfiedPredicate < ' tcx > ] ,
32123185 ) -> bool {
32133186 let mut derives = self . note_predicate_source_and_get_derives ( err, unsatisfied_predicates) ;
32143187 derives. sort ( ) ;
0 commit comments