-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
The SelectionContext
currently has this vector, inferred_obligations
:
rust/src/librustc/traits/select.rs
Line 95 in 9cb18a9
inferred_obligations: SnapshotVec<InferredObligationsSnapshotVecDelegate<'tcx>>, |
It is used to accumulate obligations during matching operations and so forth that takes in a select
, for example here:
rust/src/librustc/traits/select.rs
Line 1559 in 9cb18a9
self.inferred_obligations.extend(obligations); |
These are then stored in the vector and later added to the candidate currently under construction:
rust/src/librustc/traits/select.rs
Lines 565 to 566 in 9cb18a9
let inferred_obligations = (*self.inferred_obligations).into_iter().cloned(); | |
candidate.nested_obligations_mut().extend(inferred_obligations); |
It's a kinda confusing setup, since the flow of information is hidden, and it's not really needed. This commit factors it away, but it does so in the context of a long branch, and can't really be directly cherry-picked:
Still, the general strategy should be visible. Instead of using the inferred_obligations
vector, we basically just thread obligations around explicitly.