@@ -491,6 +491,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
491491 }
492492
493493 fn reset ( & mut self ) {
494+ debug ! ( "reset" ) ;
494495 self . inherent_candidates . clear ( ) ;
495496 self . extension_candidates . clear ( ) ;
496497 self . impl_dups . clear ( ) ;
@@ -505,13 +506,16 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
505506 candidate : Candidate < ' tcx > ,
506507 is_inherent : bool )
507508 {
509+ debug ! ( "push_candidate: candidate={:?} is_inherent={:?}" , candidate, is_inherent) ;
508510 let is_accessible = if let Some ( name) = self . method_name {
509511 let item = candidate. item ;
510512 let def_scope = self . tcx . adjust_ident ( name, item. container . id ( ) , self . body_id ) . 1 ;
511513 item. vis . is_accessible_from ( def_scope, self . tcx )
512514 } else {
513515 true
514516 } ;
517+
518+ debug ! ( "push_candidate: is_accessible={:?}" , is_accessible) ;
515519 if is_accessible {
516520 if is_inherent {
517521 self . inherent_candidates . push ( candidate) ;
@@ -847,6 +851,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
847851 }
848852
849853 fn assemble_extension_candidates_for_all_traits ( & mut self ) -> Result < ( ) , MethodError < ' tcx > > {
854+ debug ! ( "assemble_extension_candidates_for_all_traits" ) ;
850855 let mut duplicates = FxHashSet :: default ( ) ;
851856 for trait_info in suggest:: all_traits ( self . tcx ) {
852857 if duplicates. insert ( trait_info. def_id ) {
@@ -939,6 +944,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
939944 // THE ACTUAL SEARCH
940945
941946 fn pick ( mut self ) -> PickResult < ' tcx > {
947+ debug ! ( "pick: method_name={:?}" , self . method_name) ;
942948 assert ! ( self . method_name. is_some( ) ) ;
943949
944950 if let Some ( r) = self . pick_core ( ) {
@@ -958,9 +964,13 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
958964 self . assemble_extension_candidates_for_all_traits ( ) ?;
959965
960966 let out_of_scope_traits = match self . pick_core ( ) {
961- Some ( Ok ( p) ) => vec ! [ p. item. container. id( ) ] ,
967+ Some ( Ok ( p) ) => {
968+ debug ! ( "pick: (ok) p={:?}" , p) ;
969+ vec ! [ p. item. container. id( ) ]
970+ } ,
962971 //Some(Ok(p)) => p.iter().map(|p| p.item.container().id()).collect(),
963972 Some ( Err ( MethodError :: Ambiguity ( v) ) ) => {
973+ debug ! ( "pick: (ambiguity) v={:?}" , v) ;
964974 v. into_iter ( )
965975 . map ( |source| {
966976 match source {
@@ -979,6 +989,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
979989 . collect ( )
980990 }
981991 Some ( Err ( MethodError :: NoMatch ( NoMatchData { out_of_scope_traits : others, .. } ) ) ) => {
992+ debug ! ( "pick: (no match) others={:?}" , others) ;
982993 assert ! ( others. is_empty( ) ) ;
983994 vec ! [ ]
984995 }
@@ -990,6 +1001,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
9901001 }
9911002 let lev_candidate = self . probe_for_lev_candidate ( ) ?;
9921003
1004+ debug ! ( "pick: out_of_scope_traits={:?}" , out_of_scope_traits) ;
9931005 Err ( MethodError :: NoMatch ( NoMatchData :: new ( static_candidates,
9941006 unsatisfied_predicates,
9951007 out_of_scope_traits,
@@ -1302,13 +1314,20 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
13021314 let predicate = trait_ref. to_predicate ( ) ;
13031315 let obligation =
13041316 traits:: Obligation :: new ( cause, self . param_env , predicate) ;
1317+ debug ! (
1318+ "consider_probe: predicate={:?} obligation={:?} trait_ref={:?}" ,
1319+ predicate, obligation, trait_ref
1320+ ) ;
13051321 if !self . predicate_may_hold ( & obligation) {
1322+ debug ! ( "consider_probe: predicate did not hold" ) ;
13061323 if self . probe ( |_| self . select_trait_candidate ( trait_ref) . is_err ( ) ) {
1324+ debug ! ( "consider_probe: select_trait_candidate.is_err=true" ) ;
13071325 // This candidate's primary obligation doesn't even
13081326 // select - don't bother registering anything in
13091327 // `potentially_unsatisfied_predicates`.
13101328 return ProbeResult :: NoMatch ;
13111329 } else {
1330+ debug ! ( "consider_probe: nested subobligation" ) ;
13121331 // Some nested subobligation of this predicate
13131332 // failed.
13141333 //
0 commit comments