1 error[E0597]: `x` does not live long enough
2 --> $DIR/patterns.rs:6:9
5 | - binding `x` declared here
6 LL | let y: &'static u32;
7 | ------------ type annotation requires that `x` is borrowed for `'static`
9 | ^^ borrowed value does not live long enough
11 | - `x` dropped here while still borrowed
13 error[E0597]: `x` does not live long enough
14 --> $DIR/patterns.rs:14:9
17 | - binding `x` declared here
18 LL | let (y, z): (&'static u32, &'static u32);
19 | ---------------------------- type annotation requires that `x` is borrowed for `'static`
21 | ^^ borrowed value does not live long enough
23 | - `x` dropped here while still borrowed
25 error[E0597]: `x` does not live long enough
26 --> $DIR/patterns.rs:20:13
29 | - binding `x` declared here
31 | ^^ borrowed value does not live long enough
32 LL | let ref z: &'static u32 = y;
33 | ------------ type annotation requires that `x` is borrowed for `'static`
36 | - `x` dropped here while still borrowed
38 error[E0597]: `x` does not live long enough
39 --> $DIR/patterns.rs:39:9
42 | - binding `x` declared here
43 LL | let Single { value: y }: Single<&'static u32>;
44 | -------------------- type annotation requires that `x` is borrowed for `'static`
46 | ^^ borrowed value does not live long enough
48 | - `x` dropped here while still borrowed
50 error[E0597]: `x` does not live long enough
51 --> $DIR/patterns.rs:51:10
54 | - binding `x` declared here
55 LL | let Single2 { value: mut _y }: Single2<StaticU32>;
56 | ------------------ type annotation requires that `x` is borrowed for `'static`
58 | ^^ borrowed value does not live long enough
60 | - `x` dropped here while still borrowed
62 error[E0597]: `x` does not live long enough
63 --> $DIR/patterns.rs:56:27
66 | - binding `x` declared here
67 LL | let y: &'static u32 = &x;
68 | ------------ ^^ borrowed value does not live long enough
70 | type annotation requires that `x` is borrowed for `'static`
72 | - `x` dropped here while still borrowed
74 error[E0597]: `x` does not live long enough
75 --> $DIR/patterns.rs:61:27
78 | - binding `x` declared here
79 LL | let _: &'static u32 = &x;
80 | ------------ ^^ borrowed value does not live long enough
82 | type annotation requires that `x` is borrowed for `'static`
85 | - `x` dropped here while still borrowed
87 error[E0716]: temporary value dropped while borrowed
88 --> $DIR/patterns.rs:63:41
90 LL | let _: Vec<&'static String> = vec![&String::new()];
91 | -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
93 | | creates a temporary value which is freed while still in use
94 | type annotation requires that borrow lasts for `'static`
96 error[E0716]: temporary value dropped while borrowed
97 --> $DIR/patterns.rs:66:52
99 LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
100 | ------------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
102 | | creates a temporary value which is freed while still in use
103 | type annotation requires that borrow lasts for `'static`
105 error[E0716]: temporary value dropped while borrowed
106 --> $DIR/patterns.rs:69:53
108 LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
109 | ------------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
111 | | creates a temporary value which is freed while still in use
112 | type annotation requires that borrow lasts for `'static`
114 error[E0597]: `x` does not live long enough
115 --> $DIR/patterns.rs:75:40
118 | - binding `x` declared here
119 LL | let (_, _): (&'static u32, u32) = (&x, 44);
120 | ------------------- ^^ borrowed value does not live long enough
122 | type annotation requires that `x` is borrowed for `'static`
124 | - `x` dropped here while still borrowed
126 error[E0597]: `x` does not live long enough
127 --> $DIR/patterns.rs:80:40
130 | - binding `x` declared here
131 LL | let (y, _): (&'static u32, u32) = (&x, 44);
132 | ------------------- ^^ borrowed value does not live long enough
134 | type annotation requires that `x` is borrowed for `'static`
136 | - `x` dropped here while still borrowed
138 error[E0597]: `x` does not live long enough
139 --> $DIR/patterns.rs:85:69
142 | - binding `x` declared here
143 LL | let Single { value: y }: Single<&'static u32> = Single { value: &x };
144 | -------------------- ^^ borrowed value does not live long enough
146 | type annotation requires that `x` is borrowed for `'static`
148 | - `x` dropped here while still borrowed
150 error[E0597]: `x` does not live long enough
151 --> $DIR/patterns.rs:90:69
154 | - binding `x` declared here
155 LL | let Single { value: _ }: Single<&'static u32> = Single { value: &x };
156 | -------------------- ^^ borrowed value does not live long enough
158 | type annotation requires that `x` is borrowed for `'static`
160 | - `x` dropped here while still borrowed
162 error[E0597]: `x` does not live long enough
163 --> $DIR/patterns.rs:98:17
166 | - binding `x` declared here
167 LL | let Double { value1: _, value2: _ }: Double<&'static u32> = Double {
168 | -------------------- type annotation requires that `x` is borrowed for `'static`
170 | ^^ borrowed value does not live long enough
173 | - `x` dropped here while still borrowed
175 error: lifetime may not live long enough
176 --> $DIR/patterns.rs:111:5
178 LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 {
179 | -- lifetime `'a` defined here
182 | ^ returning this value requires that `'a` must outlive `'static`
184 error: lifetime may not live long enough
185 --> $DIR/patterns.rs:123:5
187 LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 {
188 | -- lifetime `'a` defined here
191 | ^ returning this value requires that `'a` must outlive `'static`
193 error: lifetime may not live long enough
194 --> $DIR/patterns.rs:128:5
196 LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 {
197 | -- lifetime `'a` defined here
198 LL | let Single { value: y }: Single<&'a u32> = Single { value: &22 };
200 | ^ returning this value requires that `'a` must outlive `'static`
202 error: lifetime may not live long enough
203 --> $DIR/patterns.rs:132:18
205 LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 {
206 | -- lifetime `'a` defined here
207 LL | let (y, _z): (&'static u32, u32) = (x, 44);
208 | ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
210 error: aborting due to 19 previous errors
212 Some errors have detailed explanations: E0597, E0716.
213 For more information about an error, try `rustc --explain E0597`.