11use super :: suggest;
2+ use super :: CandidateSource ;
23use super :: MethodError ;
34use super :: NoMatchData ;
4- use super :: { CandidateSource , ImplSource , TraitSource } ;
55
66use crate :: check:: FnCtxt ;
77use crate :: errors:: MethodCallOnUnknownType ;
@@ -694,7 +694,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
694694 for item in self . impl_or_trait_item ( impl_def_id) {
695695 if !self . has_applicable_self ( & item) {
696696 // No receiver declared. Not a candidate.
697- self . record_static_candidate ( ImplSource ( impl_def_id) ) ;
697+ self . record_static_candidate ( CandidateSource :: Impl ( impl_def_id) ) ;
698698 continue ;
699699 }
700700
@@ -848,7 +848,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
848848 debug ! ( "elaborate_bounds(bound_trait_ref={:?})" , bound_trait_ref) ;
849849 for item in self . impl_or_trait_item ( bound_trait_ref. def_id ( ) ) {
850850 if !self . has_applicable_self ( & item) {
851- self . record_static_candidate ( TraitSource ( bound_trait_ref. def_id ( ) ) ) ;
851+ self . record_static_candidate ( CandidateSource :: Trait ( bound_trait_ref. def_id ( ) ) ) ;
852852 } else {
853853 mk_cand ( self , bound_trait_ref, item) ;
854854 }
@@ -946,7 +946,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
946946 // Check whether `trait_def_id` defines a method with suitable name.
947947 if !self . has_applicable_self ( & item) {
948948 debug ! ( "method has inapplicable self" ) ;
949- self . record_static_candidate ( TraitSource ( trait_def_id) ) ;
949+ self . record_static_candidate ( CandidateSource :: Trait ( trait_def_id) ) ;
950950 continue ;
951951 }
952952
@@ -1018,8 +1018,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
10181018 Some ( Err ( MethodError :: Ambiguity ( v) ) ) => v
10191019 . into_iter ( )
10201020 . map ( |source| match source {
1021- TraitSource ( id) => id,
1022- ImplSource ( impl_id) => match tcx. trait_id_of_impl ( impl_id) {
1021+ CandidateSource :: Trait ( id) => id,
1022+ CandidateSource :: Impl ( impl_id) => match tcx. trait_id_of_impl ( impl_id) {
10231023 Some ( id) => id,
10241024 None => span_bug ! ( span, "found inherent method when looking at traits" ) ,
10251025 } ,
@@ -1417,8 +1417,10 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
14171417
14181418 fn candidate_source ( & self , candidate : & Candidate < ' tcx > , self_ty : Ty < ' tcx > ) -> CandidateSource {
14191419 match candidate. kind {
1420- InherentImplCandidate ( ..) => ImplSource ( candidate. item . container . id ( ) ) ,
1421- ObjectCandidate | WhereClauseCandidate ( _) => TraitSource ( candidate. item . container . id ( ) ) ,
1420+ InherentImplCandidate ( ..) => CandidateSource :: Impl ( candidate. item . container . id ( ) ) ,
1421+ ObjectCandidate | WhereClauseCandidate ( _) => {
1422+ CandidateSource :: Trait ( candidate. item . container . id ( ) )
1423+ }
14221424 TraitCandidate ( trait_ref) => self . probe ( |_| {
14231425 let _ = self
14241426 . at ( & ObligationCause :: dummy ( ) , self . param_env )
@@ -1428,9 +1430,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
14281430 Ok ( Some ( traits:: ImplSource :: UserDefined ( ref impl_data) ) ) => {
14291431 // If only a single impl matches, make the error message point
14301432 // to that impl.
1431- ImplSource ( impl_data. impl_def_id )
1433+ CandidateSource :: Impl ( impl_data. impl_def_id )
14321434 }
1433- _ => TraitSource ( candidate. item . container . id ( ) ) ,
1435+ _ => CandidateSource :: Trait ( candidate. item . container . id ( ) ) ,
14341436 }
14351437 } ) ,
14361438 }
0 commit comments