fork/rust

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

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

master
8.0 KiB152 linesraw
1error: lifetime may not live long enough
2  --> $DIR/variadic-ffi-4.rs:8:5
3   |
4LL | pub unsafe extern "C" fn no_escape0<'f>(_: usize, ap: ...) -> VaListImpl<'f> {
5   |                                     --            -- has type `VaListImpl<'1>`
6   |                                     |
7   |                                     lifetime `'f` defined here
8LL |     ap
9   |     ^^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'f`
10   |
11   = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant
12   = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f`
13   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
14
15error: lifetime may not live long enough
16  --> $DIR/variadic-ffi-4.rs:8:5
17   |
18LL | pub unsafe extern "C" fn no_escape0<'f>(_: usize, ap: ...) -> VaListImpl<'f> {
19   |                                     --            -- has type `VaListImpl<'1>`
20   |                                     |
21   |                                     lifetime `'f` defined here
22LL |     ap
23   |     ^^ function was supposed to return data with lifetime `'f` but it is returning data with lifetime `'1`
24   |
25   = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant
26   = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f`
27   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
28
29error: lifetime may not live long enough
30  --> $DIR/variadic-ffi-4.rs:14:5
31   |
32LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaListImpl<'static> {
33   |                                               -- has type `VaListImpl<'1>`
34LL |     ap
35   |     ^^ returning this value requires that `'1` must outlive `'static`
36   |
37   = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant
38   = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f`
39   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
40
41error: lifetime may not live long enough
42  --> $DIR/variadic-ffi-4.rs:18:31
43   |
44LL |     let _ = ap.with_copy(|ap| ap);
45   |                           --- ^^ returning this value requires that `'1` must outlive `'2`
46   |                           | |
47   |                           | return type of closure is VaList<'2, '_>
48   |                           has type `VaList<'1, '_>`
49
50error: lifetime may not live long enough
51  --> $DIR/variadic-ffi-4.rs:22:5
52   |
53LL | pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
54   |                                               -------                   ------- has type `VaListImpl<'2>`
55   |                                               |
56   |                                               has type `&mut VaListImpl<'1>`
57LL |     *ap0 = ap1;
58   |     ^^^^ assignment requires that `'1` must outlive `'2`
59   |
60   = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant
61   = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f`
62   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
63
64error: lifetime may not live long enough
65  --> $DIR/variadic-ffi-4.rs:22:5
66   |
67LL | pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
68   |                                               -------                   ------- has type `VaListImpl<'2>`
69   |                                               |
70   |                                               has type `&mut VaListImpl<'1>`
71LL |     *ap0 = ap1;
72   |     ^^^^ assignment requires that `'2` must outlive `'1`
73   |
74   = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant
75   = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f`
76   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
77
78error: lifetime may not live long enough
79  --> $DIR/variadic-ffi-4.rs:28:5
80   |
81LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
82   |                                               -------                   ------- has type `VaListImpl<'2>`
83   |                                               |
84   |                                               has type `&mut VaListImpl<'1>`
85LL |     ap0 = &mut ap1;
86   |     ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
87   |
88   = note: requirement occurs because of a mutable reference to `VaListImpl<'_>`
89   = note: mutable references are invariant over their type parameter
90   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
91
92error: lifetime may not live long enough
93  --> $DIR/variadic-ffi-4.rs:28:5
94   |
95LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
96   |                                               -------                   ------- has type `VaListImpl<'2>`
97   |                                               |
98   |                                               has type `&mut VaListImpl<'1>`
99LL |     ap0 = &mut ap1;
100   |     ^^^^^^^^^^^^^^ assignment requires that `'2` must outlive `'1`
101   |
102   = note: requirement occurs because of a mutable reference to `VaListImpl<'_>`
103   = note: mutable references are invariant over their type parameter
104   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
105
106error[E0597]: `ap1` does not live long enough
107  --> $DIR/variadic-ffi-4.rs:28:11
108   |
109LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
110   |                                                        -                ------- binding `ap1` declared here
111   |                                                        |
112   |                                                        let's call the lifetime of this reference `'3`
113LL |     ap0 = &mut ap1;
114   |     ------^^^^^^^^
115   |     |     |
116   |     |     borrowed value does not live long enough
117   |     assignment requires that `ap1` is borrowed for `'3`
118...
119LL | }
120   | - `ap1` dropped here while still borrowed
121
122error: lifetime may not live long enough
123  --> $DIR/variadic-ffi-4.rs:35:12
124   |
125LL | pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
126   |                                               -------                   ------- has type `VaListImpl<'2>`
127   |                                               |
128   |                                               has type `&mut VaListImpl<'1>`
129LL |     *ap0 = ap1.clone();
130   |            ^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
131   |
132   = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant
133   = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f`
134   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
135
136error: lifetime may not live long enough
137  --> $DIR/variadic-ffi-4.rs:35:12
138   |
139LL | pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
140   |                                               -------                   ------- has type `VaListImpl<'2>`
141   |                                               |
142   |                                               has type `&mut VaListImpl<'1>`
143LL |     *ap0 = ap1.clone();
144   |            ^^^^^^^^^^^ argument requires that `'2` must outlive `'1`
145   |
146   = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant
147   = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f`
148   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
149
150error: aborting due to 11 previous errors
151
152For more information about this error, try `rustc --explain E0597`.