@@ -545,17 +545,23 @@ fn sanity_check_found_hidden_type<'tcx>(
545
545
/// }
546
546
/// fn func<'a>(x: &'a ()) -> impl Id<Assoc = impl Sized + 'a> { x }
547
547
/// // desugared to
548
+ /// fn func<'a>(x: &'a () -> Outer<'a, Assoc = Inner<'a>> {
549
+ /// // Note that in contrast to other nested items, RPIT type aliases can
550
+ /// // access their parents' generics.
548
551
///
549
- /// // hidden type is `&'bDup ()`
550
- /// // During wfcheck the hidden type of `Inner` is `&'a ()`, but
551
- /// // `typeof(Inner<'b, 'bDup>) = &'bDup ()`.
552
- /// // So we walk the signature of `func` to find the use of `Inner<'static, 'a>`
553
- /// // and then use that to replace the lifetimes in the hidden type, obtaining
554
- /// // `&'a ()`.
555
- /// type Outer<'b, 'bDup> = impl Id<Assoc = Inner<'b, 'bDup>>;
556
- /// // hidden type is `&'cDup ()`
557
- /// type Inner<'c, 'cDup> = impl Sized + 'cDup;
558
- /// fn func<'a>(x: &'a () -> Outer<'static, 'a> { x }
552
+ /// // hidden type is `&'aDupOuter ()`
553
+ /// // During wfcheck the hidden type of `Inner<'aDupOuter>` is `&'a ()`, but
554
+ /// // `typeof(Inner<'aDupOuter>) = &'aDupOuter ()`.
555
+ /// // So we walk the signature of `func` to find the use of `Inner<'a>`
556
+ /// // and then use that to replace the lifetimes in the hidden type, obtaining
557
+ /// // `&'a ()`.
558
+ /// type Outer<'aDupOuter> = impl Id<Assoc = Inner<'aDupOuter>>;
559
+ ///
560
+ /// // hidden type is `&'aDupInner ()`
561
+ /// type Inner<'aDupInner> = impl Sized + 'aDupInner;
562
+ ///
563
+ /// x
564
+ /// }
559
565
/// ```
560
566
fn find_and_apply_rpit_args < ' tcx > (
561
567
tcx : TyCtxt < ' tcx > ,
0 commit comments