fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.7 KiB44 linesraw
1error: lifetime may not live long enough
2  --> $DIR/issue-98170.rs:7:9
3   |
4LL | impl MyStruct<'_> {
5   |               -- lifetime `'1` appears in the `impl`'s self type
6LL |     pub fn new<'a>(field: &'a [u32]) -> MyStruct<'a> {
7   |                -- lifetime `'a` defined here
8LL |         Self { field }
9   |         ^^^^^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
10
11error: lifetime may not live long enough
12  --> $DIR/issue-98170.rs:7:16
13   |
14LL | impl MyStruct<'_> {
15   |               -- lifetime `'1` appears in the `impl`'s self type
16LL |     pub fn new<'a>(field: &'a [u32]) -> MyStruct<'a> {
17   |                -- lifetime `'a` defined here
18LL |         Self { field }
19   |                ^^^^^ this usage requires that `'a` must outlive `'1`
20
21error: lifetime may not live long enough
22  --> $DIR/issue-98170.rs:19:9
23   |
24LL | impl<'a> Trait<'a> for MyStruct<'_> {
25   |      --                         -- lifetime `'1` appears in the `impl`'s self type
26   |      |
27   |      lifetime `'a` defined here
28LL |     fn new(field: &'a [u32]) -> MyStruct<'a> {
29LL |         Self { field }
30   |         ^^^^^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
31
32error: lifetime may not live long enough
33  --> $DIR/issue-98170.rs:19:16
34   |
35LL | impl<'a> Trait<'a> for MyStruct<'_> {
36   |      --                         -- lifetime `'1` appears in the `impl`'s self type
37   |      |
38   |      lifetime `'a` defined here
39LL |     fn new(field: &'a [u32]) -> MyStruct<'a> {
40LL |         Self { field }
41   |                ^^^^^ this usage requires that `'a` must outlive `'1`
42
43error: aborting due to 4 previous errors
44