]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-98170.rs
Auto merge of #105145 - Ayush1325:sequential-remote-server, r=Mark-Simulacrum
[rust.git] / src / test / ui / nll / issue-98170.rs
1 pub struct MyStruct<'a> {
2     field: &'a [u32],
3 }
4
5 impl MyStruct<'_> {
6     pub fn new<'a>(field: &'a [u32]) -> MyStruct<'a> {
7         Self { field }
8         //~^ ERROR lifetime may not live long enough
9         //~| ERROR lifetime may not live long enough
10     }
11 }
12
13 trait Trait<'a> {
14     fn new(field: &'a [u32]) -> MyStruct<'a>;
15 }
16
17 impl<'a> Trait<'a> for MyStruct<'_> {
18     fn new(field: &'a [u32]) -> MyStruct<'a> {
19         Self { field }
20         //~^ ERROR lifetime may not live long enough
21         //~| ERROR lifetime may not live long enough
22     }
23 }
24
25 fn main() {}