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 ;
@@ -692,7 +692,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
692692 for item in self . impl_or_trait_item ( impl_def_id) {
693693 if !self . has_applicable_self ( & item) {
694694 // No receiver declared. Not a candidate.
695- self . record_static_candidate ( ImplSource ( impl_def_id) ) ;
695+ self . record_static_candidate ( CandidateSource :: Impl ( impl_def_id) ) ;
696696 continue ;
697697 }
698698
@@ -846,7 +846,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
846846 debug ! ( "elaborate_bounds(bound_trait_ref={:?})" , bound_trait_ref) ;
847847 for item in self . impl_or_trait_item ( bound_trait_ref. def_id ( ) ) {
848848 if !self . has_applicable_self ( & item) {
849- self . record_static_candidate ( TraitSource ( bound_trait_ref. def_id ( ) ) ) ;
849+ self . record_static_candidate ( CandidateSource :: Trait ( bound_trait_ref. def_id ( ) ) ) ;
850850 } else {
851851 mk_cand ( self , bound_trait_ref, item) ;
852852 }
@@ -944,7 +944,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
944944 // Check whether `trait_def_id` defines a method with suitable name.
945945 if !self . has_applicable_self ( & item) {
946946 debug ! ( "method has inapplicable self" ) ;
947- self . record_static_candidate ( TraitSource ( trait_def_id) ) ;
947+ self . record_static_candidate ( CandidateSource :: Trait ( trait_def_id) ) ;
948948 continue ;
949949 }
950950
@@ -1016,8 +1016,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
10161016 Some ( Err ( MethodError :: Ambiguity ( v) ) ) => v
10171017 . into_iter ( )
10181018 . map ( |source| match source {
1019- TraitSource ( id) => id,
1020- ImplSource ( impl_id) => match tcx. trait_id_of_impl ( impl_id) {
1019+ CandidateSource :: Trait ( id) => id,
1020+ CandidateSource :: Impl ( impl_id) => match tcx. trait_id_of_impl ( impl_id) {
10211021 Some ( id) => id,
10221022 None => span_bug ! ( span, "found inherent method when looking at traits" ) ,
10231023 } ,
@@ -1415,8 +1415,10 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
14151415
14161416 fn candidate_source ( & self , candidate : & Candidate < ' tcx > , self_ty : Ty < ' tcx > ) -> CandidateSource {
14171417 match candidate. kind {
1418- InherentImplCandidate ( ..) => ImplSource ( candidate. item . container . id ( ) ) ,
1419- ObjectCandidate | WhereClauseCandidate ( _) => TraitSource ( candidate. item . container . id ( ) ) ,
1418+ InherentImplCandidate ( ..) => CandidateSource :: Impl ( candidate. item . container . id ( ) ) ,
1419+ ObjectCandidate | WhereClauseCandidate ( _) => {
1420+ CandidateSource :: Trait ( candidate. item . container . id ( ) )
1421+ }
14201422 TraitCandidate ( trait_ref) => self . probe ( |_| {
14211423 let _ = self
14221424 . at ( & ObligationCause :: dummy ( ) , self . param_env )
@@ -1426,9 +1428,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
14261428 Ok ( Some ( traits:: ImplSource :: UserDefined ( ref impl_data) ) ) => {
14271429 // If only a single impl matches, make the error message point
14281430 // to that impl.
1429- ImplSource ( impl_data. impl_def_id )
1431+ CandidateSource :: Impl ( impl_data. impl_def_id )
14301432 }
1431- _ => TraitSource ( candidate. item . container . id ( ) ) ,
1433+ _ => CandidateSource :: Trait ( candidate. item . container . id ( ) ) ,
14321434 }
14331435 } ) ,
14341436 }
0 commit comments