]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-52113.rs
Rollup merge of #105216 - GuillaumeGomez:rm-unused-gui-test, r=notriddle
[rust.git] / src / test / ui / nll / issue-52113.rs
1 trait Bazinga {}
2 impl<F> Bazinga for F {}
3
4 fn produce1<'a>(data: &'a u32) -> impl Bazinga + 'a {
5     let x = move || {
6         let _data: &'a u32 = data;
7     };
8     x
9 }
10
11 fn produce2<'a>(data: &'a mut Vec<&'a u32>, value: &'a u32) -> impl Bazinga + 'a {
12     let x = move || {
13         let value: &'a u32 = value;
14         data.push(value);
15     };
16     x
17 }
18
19 fn produce3<'a, 'b: 'a>(data: &'a mut Vec<&'a u32>, value: &'b u32) -> impl Bazinga + 'a {
20     let x = move || {
21         let value: &'a u32 = value;
22         data.push(value);
23     };
24     x
25 }
26
27 fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b {
28     let x = move || {
29         let value: &'a u32 = value;
30         data.push(value); //~ ERROR lifetime may not live long enough
31     };
32     x
33 }
34
35 fn main() {}