@@ -263,7 +263,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
263263 ) -> Vec < Candidate < ' tcx > > {
264264 debug_assert_eq ! ( goal, self . resolve_vars_if_possible( goal) ) ;
265265 if let Some ( ambig) = self . assemble_self_ty_infer_ambiguity_response ( goal) {
266- return ambig;
266+ return vec ! [ ambig] ;
267267 }
268268
269269 let mut candidates = self . assemble_candidates_via_self_ty ( goal, 0 ) ;
@@ -288,15 +288,20 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
288288 fn assemble_self_ty_infer_ambiguity_response < G : GoalKind < ' tcx > > (
289289 & mut self ,
290290 goal : Goal < ' tcx , G > ,
291- ) -> Option < Vec < Candidate < ' tcx > > > {
292- goal. predicate . self_ty ( ) . is_ty_var ( ) . then ( || {
293- vec ! [ Candidate {
294- source: CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Misc ) ,
295- result: self
296- . evaluate_added_goals_and_make_canonical_response( Certainty :: AMBIGUOUS )
297- . unwrap( ) ,
298- } ]
299- } )
291+ ) -> Option < Candidate < ' tcx > > {
292+ if goal. predicate . self_ty ( ) . is_ty_var ( ) {
293+ debug ! ( "adding self_ty_infer_ambiguity_response" ) ;
294+ let source = CandidateSource :: BuiltinImpl ( BuiltinImplSource :: Misc ) ;
295+ let result = self
296+ . evaluate_added_goals_and_make_canonical_response ( Certainty :: AMBIGUOUS )
297+ . unwrap ( ) ;
298+ let mut dummy_probe = self . inspect . new_probe ( ) ;
299+ dummy_probe. probe_kind ( ProbeKind :: TraitCandidate { source, result : Ok ( result) } ) ;
300+ self . inspect . finish_probe ( dummy_probe) ;
301+ Some ( Candidate { source, result } )
302+ } else {
303+ None
304+ }
300305 }
301306
302307 /// Assemble candidates which apply to the self type. This only looks at candidate which
@@ -310,7 +315,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
310315 ) -> Vec < Candidate < ' tcx > > {
311316 debug_assert_eq ! ( goal, self . resolve_vars_if_possible( goal) ) ;
312317 if let Some ( ambig) = self . assemble_self_ty_infer_ambiguity_response ( goal) {
313- return ambig;
318+ return vec ! [ ambig] ;
314319 }
315320
316321 let mut candidates = Vec :: new ( ) ;
0 commit comments