@@ -263,7 +263,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
263
263
) -> Vec < Candidate < ' tcx > > {
264
264
debug_assert_eq ! ( goal, self . resolve_vars_if_possible( goal) ) ;
265
265
if let Some ( ambig) = self . assemble_self_ty_infer_ambiguity_response ( goal) {
266
- return ambig;
266
+ return vec ! [ ambig] ;
267
267
}
268
268
269
269
let mut candidates = self . assemble_candidates_via_self_ty ( goal, 0 ) ;
@@ -288,15 +288,20 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
288
288
fn assemble_self_ty_infer_ambiguity_response < G : GoalKind < ' tcx > > (
289
289
& mut self ,
290
290
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
+ }
300
305
}
301
306
302
307
/// Assemble candidates which apply to the self type. This only looks at candidate which
@@ -310,7 +315,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
310
315
) -> Vec < Candidate < ' tcx > > {
311
316
debug_assert_eq ! ( goal, self . resolve_vars_if_possible( goal) ) ;
312
317
if let Some ( ambig) = self . assemble_self_ty_infer_ambiguity_response ( goal) {
313
- return ambig;
318
+ return vec ! [ ambig] ;
314
319
}
315
320
316
321
let mut candidates = Vec :: new ( ) ;
0 commit comments