fork/rust

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

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
5.8 KiB123 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 `core::ffi::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
11error: lifetime may not live long enough
12  --> $DIR/variadic-ffi-4.rs:8:5
13   |
14LL | pub unsafe extern "C" fn no_escape0<'f>(_: usize, ap: ...) -> VaListImpl<'f> {
15   |                                     --            -- has type `core::ffi::VaListImpl<'1>`
16   |                                     |
17   |                                     lifetime `'f` defined here
18LL |     ap
19   |     ^^ returning this value requires that `'1` must outlive `'f`
20
21error: lifetime may not live long enough
22  --> $DIR/variadic-ffi-4.rs:12:5
23   |
24LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaListImpl<'static> {
25   |                                               -- has type `core::ffi::VaListImpl<'1>`
26LL |     ap
27   |     ^^ returning this value requires that `'1` must outlive `'static`
28
29error: lifetime may not live long enough
30  --> $DIR/variadic-ffi-4.rs:16:33
31   |
32LL |     let _ = ap.with_copy(|ap| { ap });
33   |                           ---   ^^ returning this value requires that `'1` must outlive `'2`
34   |                           | |
35   |                           | return type of closure is core::ffi::VaList<'2, '_>
36   |                           has type `core::ffi::VaList<'1, '_>`
37
38error: lifetime may not live long enough
39  --> $DIR/variadic-ffi-4.rs:20:5
40   |
41LL | pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
42   |                                               -------                   ------- has type `core::ffi::VaListImpl<'2>`
43   |                                               |
44   |                                               has type `&mut core::ffi::VaListImpl<'1>`
45LL |     *ap0 = ap1;
46   |     ^^^^ assignment requires that `'1` must outlive `'2`
47
48error: lifetime may not live long enough
49  --> $DIR/variadic-ffi-4.rs:20:5
50   |
51LL | pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
52   |                                               -------                   ------- has type `core::ffi::VaListImpl<'2>`
53   |                                               |
54   |                                               has type `&mut core::ffi::VaListImpl<'1>`
55LL |     *ap0 = ap1;
56   |     ^^^^ assignment requires that `'2` must outlive `'1`
57
58error: lifetime may not live long enough
59  --> $DIR/variadic-ffi-4.rs:24:5
60   |
61LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaListImpl, mut ap1: ...) {
62   |                                               ---                   ------- has type `core::ffi::VaListImpl<'2>`
63   |                                               |
64   |                                               has type `&mut core::ffi::VaListImpl<'1>`
65LL |     ap0 = &mut ap1;
66   |     ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
67
68error: lifetime may not live long enough
69  --> $DIR/variadic-ffi-4.rs:24:5
70   |
71LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaListImpl, mut ap1: ...) {
72   |                                               ---                   ------- has type `core::ffi::VaListImpl<'2>`
73   |                                               |
74   |                                               has type `&mut core::ffi::VaListImpl<'1>`
75LL |     ap0 = &mut ap1;
76   |     ^^^^^^^^^^^^^^ assignment requires that `'2` must outlive `'1`
77
78error[E0384]: cannot assign to immutable argument `ap0`
79  --> $DIR/variadic-ffi-4.rs:24:5
80   |
81LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaListImpl, mut ap1: ...) {
82   |                                               --- help: make this binding mutable: `mut ap0`
83LL |     ap0 = &mut ap1;
84   |     ^^^^^^^^^^^^^^ cannot assign to immutable argument
85
86error[E0597]: `ap1` does not live long enough
87  --> $DIR/variadic-ffi-4.rs:24:11
88   |
89LL | pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaListImpl, mut ap1: ...) {
90   |                                                    - let's call the lifetime of this reference `'3`
91LL |     ap0 = &mut ap1;
92   |     ------^^^^^^^^
93   |     |     |
94   |     |     borrowed value does not live long enough
95   |     assignment requires that `ap1` is borrowed for `'3`
96...
97LL | }
98   | - `ap1` dropped here while still borrowed
99
100error: lifetime may not live long enough
101  --> $DIR/variadic-ffi-4.rs:31:12
102   |
103LL | pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
104   |                                               -------                   ------- has type `core::ffi::VaListImpl<'2>`
105   |                                               |
106   |                                               has type `&mut core::ffi::VaListImpl<'1>`
107LL |     *ap0 = ap1.clone();
108   |            ^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
109
110error: lifetime may not live long enough
111  --> $DIR/variadic-ffi-4.rs:31:12
112   |
113LL | pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
114   |                                               -------                   ------- has type `core::ffi::VaListImpl<'2>`
115   |                                               |
116   |                                               has type `&mut core::ffi::VaListImpl<'1>`
117LL |     *ap0 = ap1.clone();
118   |            ^^^^^^^^^^^ argument requires that `'2` must outlive `'1`
119
120error: aborting due to 12 previous errors
121
122Some errors have detailed explanations: E0384, E0597.
123For more information about an error, try `rustc --explain E0384`.