diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2019-01-03 22:15:38 -0500 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2019-01-03 22:15:38 -0500 |
| commit | 726bdec60f8ef8c9dbb57a87cc5f2a03763b1f70 (patch) | |
| tree | 78ea76dc015464dae7421468f69660678b70ad31 | |
| parent | dadd7bb6f46b1d646abedcb327b4da111caf042e (diff) | |
| download | rust-726bdec60f8ef8c9dbb57a87cc5f2a03763b1f70.tar.gz rust-726bdec60f8ef8c9dbb57a87cc5f2a03763b1f70.zip | |
Improve comment
| -rw-r--r-- | src/librustc/traits/select.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index e5eb8e24a42..8b9863fa278 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -1095,8 +1095,15 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { .insert(trait_ref, WithDepNode::new(dep_node, result)); } - // Due to caching of projection results, it's possible for a subobligation + // For various reasons, it's possible for a subobligation // to have a *lower* recursion_depth than the obligation used to create it. + // Projection sub-obligations may be returned from the projection cache, + // which results in obligations with an 'old' recursion_depth. + // Additionally, methods like ty::wf::obligations and + // InferCtxt.subtype_predicate produce subobligations without + // taking in a 'parent' depth, causing the generated subobligations + // to have a recursion_depth of 0 + // // To ensure that obligation_depth never decreasees, we force all subobligations // to have at least the depth of the original obligation. fn add_depth<T: 'cx, I: Iterator<Item = &'cx mut Obligation<'tcx, T>>>(&self, it: I, |
