@@ -11,10 +11,10 @@ use rustc_infer::traits::ObligationCause;
1111use  rustc_middle:: infer:: unify_key:: { ConstVariableOrigin ,  ConstVariableOriginKind } ; 
1212use  rustc_middle:: traits:: solve:: inspect:: { self ,  CandidateKind } ; 
1313use  rustc_middle:: traits:: solve:: { 
14-  CanonicalInput ,  CanonicalResponse ,  Certainty ,  MaybeCause ,   PredefinedOpaques , 
15-  PredefinedOpaquesData ,  QueryResult , 
14+  CanonicalInput ,  CanonicalResponse ,  Certainty ,  IsNormalizesToHack ,   MaybeCause , 
15+  PredefinedOpaques ,   PredefinedOpaquesData ,  QueryResult , 
1616} ; 
17- use  rustc_middle:: traits:: { DefiningAnchor ,   IsNormalizesToHack } ; 
17+ use  rustc_middle:: traits:: DefiningAnchor ; 
1818use  rustc_middle:: ty:: { 
1919 self ,  OpaqueTypeKey ,  Ty ,  TyCtxt ,  TypeFoldable ,  TypeSuperVisitable ,  TypeVisitable , 
2020 TypeVisitableExt ,  TypeVisitor , 
@@ -30,6 +30,7 @@ use super::SolverMode;
3030use  super :: { search_graph:: SearchGraph ,  Goal } ; 
3131
3232mod  canonical; 
33+ mod  probe; 
3334
3435pub  struct  EvalCtxt < ' a ,  ' tcx >  { 
3536 /// The inference context that backs (mostly) inference and placeholder terms 
@@ -529,32 +530,6 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
529530} 
530531
531532impl < ' tcx >  EvalCtxt < ' _ ,  ' tcx >  { 
532-  /// `probe_kind` is only called when proof tree building is enabled so it can be 
533- /// as expensive as necessary to output the desired information. 
534- pub ( super )  fn  probe < T > ( 
535-  & mut  self , 
536-  f :  impl  FnOnce ( & mut  EvalCtxt < ' _ ,  ' tcx > )  -> T , 
537-  probe_kind :  impl  FnOnce ( & T )  -> CandidateKind < ' tcx > , 
538-  )  -> T  { 
539-  let  mut  ecx = EvalCtxt  { 
540-  infcx :  self . infcx , 
541-  var_values :  self . var_values , 
542-  predefined_opaques_in_body :  self . predefined_opaques_in_body , 
543-  max_input_universe :  self . max_input_universe , 
544-  search_graph :  self . search_graph , 
545-  nested_goals :  self . nested_goals . clone ( ) , 
546-  tainted :  self . tainted , 
547-  inspect :  self . inspect . new_goal_candidate ( ) , 
548-  } ; 
549-  let  r = self . infcx . probe ( |_| f ( & mut  ecx) ) ; 
550-  if  !self . inspect . is_noop ( )  { 
551-  let  cand_kind = probe_kind ( & r) ; 
552-  ecx. inspect . candidate_kind ( cand_kind) ; 
553-  self . inspect . goal_candidate ( ecx. inspect ) ; 
554-  } 
555-  r
556-  } 
557- 
558533 pub ( super )  fn  tcx ( & self )  -> TyCtxt < ' tcx >  { 
559534 self . infcx . tcx 
560535 } 
@@ -868,8 +843,12 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
868843 if  candidate_key. def_id  != key. def_id  { 
869844 continue ; 
870845 } 
871-  values. extend ( self . probe ( 
872-  |ecx| { 
846+  values. extend ( 
847+  self . probe ( |r| CandidateKind :: Candidate  { 
848+  name :  "opaque type storage" . into ( ) , 
849+  result :  * r, 
850+  } ) 
851+  . enter ( |ecx| { 
873852 for  ( a,  b)  in  std:: iter:: zip ( candidate_key. substs ,  key. substs )  { 
874853 ecx. eq ( param_env,  a,  b) ?; 
875854 } 
@@ -881,9 +860,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
881860 candidate_ty, 
882861 ) ; 
883862 ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes ) 
884-  } , 
885-  |r| CandidateKind :: Candidate  {  name :  "opaque type storage" . into ( ) ,  result :  * r } , 
886-  ) ) ; 
863+  } ) , 
864+  ) ; 
887865 } 
888866 values
889867 } 
0 commit comments