diff options
Diffstat (limited to '')
-rw-r--r-- | compiler/rustc_hir_analysis/src/constrained_generic_params.rs (renamed from compiler/rustc_typeck/src/constrained_generic_params.rs) | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_typeck/src/constrained_generic_params.rs b/compiler/rustc_hir_analysis/src/constrained_generic_params.rs index 8428e4664..213b89fc7 100644 --- a/compiler/rustc_typeck/src/constrained_generic_params.rs +++ b/compiler/rustc_hir_analysis/src/constrained_generic_params.rs @@ -114,9 +114,9 @@ pub fn identify_constrained_generic_params<'tcx>( /// ``` /// The impl's predicates are collected from left to right. Ignoring /// the implicit `Sized` bounds, these are -/// * T: Debug -/// * U: Iterator -/// * <U as Iterator>::Item = T -- a desugared ProjectionPredicate +/// * `T: Debug` +/// * `U: Iterator` +/// * `<U as Iterator>::Item = T` -- a desugared ProjectionPredicate /// /// When we, for example, try to go over the trait-reference /// `IntoIter<u32> as Trait`, we substitute the impl parameters with fresh @@ -132,12 +132,16 @@ pub fn identify_constrained_generic_params<'tcx>( /// /// We *do* have to be somewhat careful when projection targets contain /// projections themselves, for example in +/// +/// ```ignore (illustrative) /// impl<S,U,V,W> Trait for U where /// /* 0 */ S: Iterator<Item = U>, /// /* - */ U: Iterator, /// /* 1 */ <U as Iterator>::Item: ToOwned<Owned=(W,<V as Iterator>::Item)> /// /* 2 */ W: Iterator<Item = V> /// /* 3 */ V: Debug +/// ``` +/// /// we have to evaluate the projections in the order I wrote them: /// `V: Debug` requires `V` to be evaluated. The only projection that /// *determines* `V` is 2 (1 contains it, but *does not determine it*, |