]> git.lizzy.rs Git - rust.git/blob - src/test/ui/c-variadic/variadic-ffi-4.stderr
Rollup merge of #95376 - WaffleLapkin:drain_keep_rest, r=dtolnay
[rust.git] / src / test / ui / c-variadic / variadic-ffi-4.stderr
1 error: lifetime may not live long enough
2   --> $DIR/variadic-ffi-4.rs:8:5
3    |
4 LL | pub unsafe extern "C" fn no_escape0<'f>(_: usize, ap: ...) -> VaListImpl<'f> {
5    |                                     --            -- has type `VaListImpl<'1>`
6    |                                     |
7    |                                     lifetime `'f` defined here
8 LL |     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
15 error: lifetime may not live long enough
16   --> $DIR/variadic-ffi-4.rs:8:5
17    |
18 LL | pub unsafe extern "C" fn no_escape0<'f>(_: usize, ap: ...) -> VaListImpl<'f> {
19    |                                     --            -- has type `VaListImpl<'1>`
20    |                                     |
21    |                                     lifetime `'f` defined here
22 LL |     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
29 error: lifetime may not live long enough
30   --> $DIR/variadic-ffi-4.rs:14:5
31    |
32 LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaListImpl<'static> {
33    |                                               -- has type `VaListImpl<'1>`
34 LL |     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
41 error: lifetime may not live long enough
42   --> $DIR/variadic-ffi-4.rs:18:31
43    |
44 LL |     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
50 error: lifetime may not live long enough
51   --> $DIR/variadic-ffi-4.rs:22:5
52    |
53 LL | 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>`
57 LL |     *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
64 error: lifetime may not live long enough
65   --> $DIR/variadic-ffi-4.rs:22:5
66    |
67 LL | 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>`
71 LL |     *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
78 error: lifetime may not live long enough
79   --> $DIR/variadic-ffi-4.rs:28:5
80    |
81 LL | 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>`
85 LL |     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
92 error: lifetime may not live long enough
93   --> $DIR/variadic-ffi-4.rs:28:5
94    |
95 LL | 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>`
99 LL |     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
106 error[E0597]: `ap1` does not live long enough
107   --> $DIR/variadic-ffi-4.rs:28:11
108    |
109 LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
110    |                                                        - let's call the lifetime of this reference `'3`
111 LL |     ap0 = &mut ap1;
112    |     ------^^^^^^^^
113    |     |     |
114    |     |     borrowed value does not live long enough
115    |     assignment requires that `ap1` is borrowed for `'3`
116 ...
117 LL | }
118    | - `ap1` dropped here while still borrowed
119
120 error: lifetime may not live long enough
121   --> $DIR/variadic-ffi-4.rs:35:12
122    |
123 LL | pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
124    |                                               -------                   ------- has type `VaListImpl<'2>`
125    |                                               |
126    |                                               has type `&mut VaListImpl<'1>`
127 LL |     *ap0 = ap1.clone();
128    |            ^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
129    |
130    = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant
131    = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f`
132    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
133
134 error: lifetime may not live long enough
135   --> $DIR/variadic-ffi-4.rs:35:12
136    |
137 LL | pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
138    |                                               -------                   ------- has type `VaListImpl<'2>`
139    |                                               |
140    |                                               has type `&mut VaListImpl<'1>`
141 LL |     *ap0 = ap1.clone();
142    |            ^^^^^^^^^^^ argument requires that `'2` must outlive `'1`
143    |
144    = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant
145    = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f`
146    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
147
148 error: aborting due to 11 previous errors
149
150 For more information about this error, try `rustc --explain E0597`.