summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/user-annotations/patterns.stderr
blob: de6f8f80fe25248bcac3e425fcd37b9e639fa7fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:6:9
   |
LL |     let y: &'static u32;
   |            ------------ type annotation requires that `x` is borrowed for `'static`
LL |     y = &x;
   |         ^^ borrowed value does not live long enough
LL | }
   | - `x` dropped here while still borrowed

error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:14:9
   |
LL |     let (y, z): (&'static u32, &'static u32);
   |                 ---------------------------- type annotation requires that `x` is borrowed for `'static`
LL |     y = &x;
   |         ^^ borrowed value does not live long enough
LL | }
   | - `x` dropped here while still borrowed

error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:20:13
   |
LL |     let y = &x;
   |             ^^ borrowed value does not live long enough
LL |     let ref z: &'static u32 = y;
   |                ------------ type annotation requires that `x` is borrowed for `'static`
LL |     **z
LL | }
   | - `x` dropped here while still borrowed

error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:39:9
   |
LL |     let Single { value: y }: Single<&'static u32>;
   |                              -------------------- type annotation requires that `x` is borrowed for `'static`
LL |     y = &x;
   |         ^^ borrowed value does not live long enough
LL | }
   | - `x` dropped here while still borrowed

error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:51:10
   |
LL |     let Single2 { value: mut _y }: Single2<StaticU32>;
   |                                    ------------------ type annotation requires that `x` is borrowed for `'static`
LL |     _y = &x;
   |          ^^ borrowed value does not live long enough
LL | }
   | - `x` dropped here while still borrowed

error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:56:27
   |
LL |     let y: &'static u32 = &x;
   |            ------------   ^^ borrowed value does not live long enough
   |            |
   |            type annotation requires that `x` is borrowed for `'static`
LL | }
   | - `x` dropped here while still borrowed

error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:61:27
   |
LL |     let _: &'static u32 = &x;
   |            ------------   ^^ borrowed value does not live long enough
   |            |
   |            type annotation requires that `x` is borrowed for `'static`
...
LL | }
   | - `x` dropped here while still borrowed

error[E0716]: temporary value dropped while borrowed
  --> $DIR/patterns.rs:63:41
   |
LL |     let _: Vec<&'static String> = vec![&String::new()];
   |            --------------------         ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
   |            |                            |
   |            |                            creates a temporary value which is freed while still in use
   |            type annotation requires that borrow lasts for `'static`

error[E0716]: temporary value dropped while borrowed
  --> $DIR/patterns.rs:66:52
   |
LL |     let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
   |                 -------------------------          ^^^^^^^^^^^^^      - temporary value is freed at the end of this statement
   |                 |                                  |
   |                 |                                  creates a temporary value which is freed while still in use
   |                 type annotation requires that borrow lasts for `'static`

error[E0716]: temporary value dropped while borrowed
  --> $DIR/patterns.rs:69:53
   |
LL |     let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
   |                  -------------------------          ^^^^^^^^^^^^^      - temporary value is freed at the end of this statement
   |                  |                                  |
   |                  |                                  creates a temporary value which is freed while still in use
   |                  type annotation requires that borrow lasts for `'static`

error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:75:40
   |
LL |     let (_, _): (&'static u32, u32) = (&x, 44);
   |                 -------------------    ^^ borrowed value does not live long enough
   |                 |
   |                 type annotation requires that `x` is borrowed for `'static`
LL | }
   | - `x` dropped here while still borrowed

error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:80:40
   |
LL |     let (y, _): (&'static u32, u32) = (&x, 44);
   |                 -------------------    ^^ borrowed value does not live long enough
   |                 |
   |                 type annotation requires that `x` is borrowed for `'static`
LL | }
   | - `x` dropped here while still borrowed

error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:85:69
   |
LL |     let Single { value: y }: Single<&'static u32> = Single { value: &x };
   |                              --------------------                   ^^ borrowed value does not live long enough
   |                              |
   |                              type annotation requires that `x` is borrowed for `'static`
LL | }
   | - `x` dropped here while still borrowed

error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:90:69
   |
LL |     let Single { value: _ }: Single<&'static u32> = Single { value: &x };
   |                              --------------------                   ^^ borrowed value does not live long enough
   |                              |
   |                              type annotation requires that `x` is borrowed for `'static`
LL | }
   | - `x` dropped here while still borrowed

error[E0597]: `x` does not live long enough
  --> $DIR/patterns.rs:98:17
   |
LL |     let Double { value1: _, value2: _ }: Double<&'static u32> = Double {
   |                                          -------------------- type annotation requires that `x` is borrowed for `'static`
LL |         value1: &x,
   |                 ^^ borrowed value does not live long enough
...
LL | }
   | - `x` dropped here while still borrowed

error: lifetime may not live long enough
  --> $DIR/patterns.rs:111:5
   |
LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 {
   |                                           -- lifetime `'a` defined here
...
LL |     y
   |     ^ returning this value requires that `'a` must outlive `'static`

error: lifetime may not live long enough
  --> $DIR/patterns.rs:123:5
   |
LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 {
   |                                        -- lifetime `'a` defined here
...
LL |     y
   |     ^ returning this value requires that `'a` must outlive `'static`

error: lifetime may not live long enough
  --> $DIR/patterns.rs:128:5
   |
LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 {
   |                                         -- lifetime `'a` defined here
LL |     let Single { value: y }: Single<&'a u32> = Single { value: &22 };
LL |     y
   |     ^ returning this value requires that `'a` must outlive `'static`

error: lifetime may not live long enough
  --> $DIR/patterns.rs:132:18
   |
LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 {
   |                            -- lifetime `'a` defined here
LL |     let (y, _z): (&'static u32, u32) = (x, 44);
   |                  ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`

error: aborting due to 19 previous errors

Some errors have detailed explanations: E0597, E0716.
For more information about an error, try `rustc --explain E0597`.