@@ -277,12 +277,25 @@ impl<'a, 'tcx> InspectGoal<'a, 'tcx> {
277
277
match * step {
278
278
inspect:: ProbeStep :: AddGoal ( source, goal) => nested_goals. push ( ( source, goal) ) ,
279
279
inspect:: ProbeStep :: NestedProbe ( ref probe) => {
280
- // Nested probes have to prove goals added in their parent
281
- // but do not leak them, so we truncate the added goals
282
- // afterwards.
283
- let num_goals = nested_goals. len ( ) ;
284
- self . candidates_recur ( candidates, nested_goals, probe) ;
285
- nested_goals. truncate ( num_goals) ;
280
+ match probe. kind {
281
+ // These never assemble candidates for the goal we're trying to solve.
282
+ inspect:: ProbeKind :: UpcastProjectionCompatibility
283
+ | inspect:: ProbeKind :: ShadowedEnvProbing => continue ,
284
+
285
+ inspect:: ProbeKind :: NormalizedSelfTyAssembly
286
+ | inspect:: ProbeKind :: UnsizeAssembly
287
+ | inspect:: ProbeKind :: Root { .. }
288
+ | inspect:: ProbeKind :: TryNormalizeNonRigid { .. }
289
+ | inspect:: ProbeKind :: TraitCandidate { .. }
290
+ | inspect:: ProbeKind :: OpaqueTypeStorageLookup { .. } => {
291
+ // Nested probes have to prove goals added in their parent
292
+ // but do not leak them, so we truncate the added goals
293
+ // afterwards.
294
+ let num_goals = nested_goals. len ( ) ;
295
+ self . candidates_recur ( candidates, nested_goals, probe) ;
296
+ nested_goals. truncate ( num_goals) ;
297
+ }
298
+ }
286
299
}
287
300
inspect:: ProbeStep :: MakeCanonicalResponse { shallow_certainty : c } => {
288
301
assert_eq ! ( shallow_certainty. replace( c) , None ) ;
@@ -295,9 +308,10 @@ impl<'a, 'tcx> InspectGoal<'a, 'tcx> {
295
308
}
296
309
297
310
match probe. kind {
298
- inspect:: ProbeKind :: NormalizedSelfTyAssembly
299
- | inspect:: ProbeKind :: UnsizeAssembly
300
- | inspect:: ProbeKind :: UpcastProjectionCompatibility => ( ) ,
311
+ inspect:: ProbeKind :: UpcastProjectionCompatibility
312
+ | inspect:: ProbeKind :: ShadowedEnvProbing => bug ! ( ) ,
313
+
314
+ inspect:: ProbeKind :: NormalizedSelfTyAssembly | inspect:: ProbeKind :: UnsizeAssembly => { }
301
315
302
316
// We add a candidate even for the root evaluation if there
303
317
// is only one way to prove a given goal, e.g. for `WellFormed`.
0 commit comments