3 #![allow(dead_code, unused_variables)]
5 // Issue #21633: reject duplicate loop labels in function bodies.
7 // Test rejection of lifetimes in *expressions* that shadow loop labels.
10 // Reusing lifetime `'a` in function item is okay.
11 fn foo<'a>(x: &'a i8) -> i8 { *x }
13 // So is reusing `'a` in struct item
14 struct S1<'a> { x: &'a i8 } impl<'a> S1<'a> { fn m(&self) {} }
16 struct S2; impl S2 { fn m<'a>(&self) {} }
21 let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>;
22 //~^ WARN lifetime name `'a` shadows a label name that is already in scope
23 assert_eq!((*b)(&z), z);