File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -844,7 +844,7 @@ impl<'a> LoweringContext<'a> {
844
844
/// header, we convert it to an in-band lifetime.
845
845
fn collect_fresh_in_band_lifetime ( & mut self , span : Span ) -> ParamName {
846
846
assert ! ( self . is_collecting_in_band_lifetimes) ;
847
- let index = self . lifetimes_to_define . len ( ) ;
847
+ let index = self . lifetimes_to_define . len ( ) + self . in_scope_lifetimes . len ( ) ;
848
848
let hir_name = ParamName :: Fresh ( index) ;
849
849
self . lifetimes_to_define . push ( ( span, hir_name) ) ;
850
850
hir_name
Original file line number Diff line number Diff line change
1
+ // check-pass
2
+ // Check that the anonymous lifetimes used here aren't considered to shadow one
3
+ // another. Note that `async fn` is different to `fn` here because the lifetimes
4
+ // are numbered by HIR lowering, rather than lifetime resolution.
5
+
6
+ // edition:2018
7
+
8
+ struct A < ' a , ' b > ( & ' a & ' b i32 ) ;
9
+ struct B < ' a > ( & ' a i32 ) ;
10
+
11
+ impl A < ' _ , ' _ > {
12
+ async fn assoc ( x : & u32 , y : B < ' _ > ) {
13
+ async fn nested ( x : & u32 , y : A < ' _ , ' _ > ) { }
14
+ }
15
+
16
+ async fn assoc2 ( x : & u32 , y : A < ' _ , ' _ > ) {
17
+ impl A < ' _ , ' _ > {
18
+ async fn nested_assoc ( x : & u32 , y : B < ' _ > ) { }
19
+ }
20
+ }
21
+ }
22
+
23
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments