1
1
error: the type `&'static T` does not permit zero-initialization
2
- --> $DIR/uninitialized-zeroed.rs:28 :32
2
+ --> $DIR/uninitialized-zeroed.rs:29 :32
3
3
|
4
4
LL | let _val: &'static T = mem::zeroed();
5
5
| ^^^^^^^^^^^^^
@@ -15,7 +15,7 @@ LL | #![deny(invalid_value)]
15
15
= note: References must be non-null
16
16
17
17
error: the type `&'static T` does not permit being left uninitialized
18
- --> $DIR/uninitialized-zeroed.rs:29 :32
18
+ --> $DIR/uninitialized-zeroed.rs:30 :32
19
19
|
20
20
LL | let _val: &'static T = mem::uninitialized();
21
21
| ^^^^^^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ LL | let _val: &'static T = mem::uninitialized();
26
26
= note: References must be non-null
27
27
28
28
error: the type `Wrap<&'static T>` does not permit zero-initialization
29
- --> $DIR/uninitialized-zeroed.rs:31 :38
29
+ --> $DIR/uninitialized-zeroed.rs:32 :38
30
30
|
31
31
LL | let _val: Wrap<&'static T> = mem::zeroed();
32
32
| ^^^^^^^^^^^^^
@@ -35,13 +35,13 @@ LL | let _val: Wrap<&'static T> = mem::zeroed();
35
35
| help: use `MaybeUninit<T>` instead
36
36
|
37
37
note: References must be non-null (in this struct field)
38
- --> $DIR/uninitialized-zeroed.rs:17 :18
38
+ --> $DIR/uninitialized-zeroed.rs:18 :18
39
39
|
40
40
LL | struct Wrap<T> { wrapped: T }
41
41
| ^^^^^^^^^^
42
42
43
43
error: the type `Wrap<&'static T>` does not permit being left uninitialized
44
- --> $DIR/uninitialized-zeroed.rs:32 :38
44
+ --> $DIR/uninitialized-zeroed.rs:33 :38
45
45
|
46
46
LL | let _val: Wrap<&'static T> = mem::uninitialized();
47
47
| ^^^^^^^^^^^^^^^^^^^^
@@ -50,13 +50,13 @@ LL | let _val: Wrap<&'static T> = mem::uninitialized();
50
50
| help: use `MaybeUninit<T>` instead
51
51
|
52
52
note: References must be non-null (in this struct field)
53
- --> $DIR/uninitialized-zeroed.rs:17 :18
53
+ --> $DIR/uninitialized-zeroed.rs:18 :18
54
54
|
55
55
LL | struct Wrap<T> { wrapped: T }
56
56
| ^^^^^^^^^^
57
57
58
58
error: the type `!` does not permit zero-initialization
59
- --> $DIR/uninitialized-zeroed.rs:39 :23
59
+ --> $DIR/uninitialized-zeroed.rs:40 :23
60
60
|
61
61
LL | let _val: ! = mem::zeroed();
62
62
| ^^^^^^^^^^^^^
@@ -67,7 +67,7 @@ LL | let _val: ! = mem::zeroed();
67
67
= note: The never type (`!`) has no valid value
68
68
69
69
error: the type `!` does not permit being left uninitialized
70
- --> $DIR/uninitialized-zeroed.rs:40 :23
70
+ --> $DIR/uninitialized-zeroed.rs:41 :23
71
71
|
72
72
LL | let _val: ! = mem::uninitialized();
73
73
| ^^^^^^^^^^^^^^^^^^^^
@@ -78,7 +78,7 @@ LL | let _val: ! = mem::uninitialized();
78
78
= note: The never type (`!`) has no valid value
79
79
80
80
error: the type `(i32, !)` does not permit zero-initialization
81
- --> $DIR/uninitialized-zeroed.rs:42 :30
81
+ --> $DIR/uninitialized-zeroed.rs:43 :30
82
82
|
83
83
LL | let _val: (i32, !) = mem::zeroed();
84
84
| ^^^^^^^^^^^^^
@@ -89,7 +89,7 @@ LL | let _val: (i32, !) = mem::zeroed();
89
89
= note: The never type (`!`) has no valid value
90
90
91
91
error: the type `(i32, !)` does not permit being left uninitialized
92
- --> $DIR/uninitialized-zeroed.rs:43 :30
92
+ --> $DIR/uninitialized-zeroed.rs:44 :30
93
93
|
94
94
LL | let _val: (i32, !) = mem::uninitialized();
95
95
| ^^^^^^^^^^^^^^^^^^^^
@@ -100,7 +100,7 @@ LL | let _val: (i32, !) = mem::uninitialized();
100
100
= note: The never type (`!`) has no valid value
101
101
102
102
error: the type `Void` does not permit zero-initialization
103
- --> $DIR/uninitialized-zeroed.rs:45 :26
103
+ --> $DIR/uninitialized-zeroed.rs:46 :26
104
104
|
105
105
LL | let _val: Void = mem::zeroed();
106
106
| ^^^^^^^^^^^^^
@@ -111,7 +111,7 @@ LL | let _val: Void = mem::zeroed();
111
111
= note: 0-variant enums have no valid value
112
112
113
113
error: the type `Void` does not permit being left uninitialized
114
- --> $DIR/uninitialized-zeroed.rs:46 :26
114
+ --> $DIR/uninitialized-zeroed.rs:47 :26
115
115
|
116
116
LL | let _val: Void = mem::uninitialized();
117
117
| ^^^^^^^^^^^^^^^^^^^^
@@ -122,7 +122,7 @@ LL | let _val: Void = mem::uninitialized();
122
122
= note: 0-variant enums have no valid value
123
123
124
124
error: the type `&'static i32` does not permit zero-initialization
125
- --> $DIR/uninitialized-zeroed.rs:48 :34
125
+ --> $DIR/uninitialized-zeroed.rs:49 :34
126
126
|
127
127
LL | let _val: &'static i32 = mem::zeroed();
128
128
| ^^^^^^^^^^^^^
@@ -133,7 +133,7 @@ LL | let _val: &'static i32 = mem::zeroed();
133
133
= note: References must be non-null
134
134
135
135
error: the type `&'static i32` does not permit being left uninitialized
136
- --> $DIR/uninitialized-zeroed.rs:49 :34
136
+ --> $DIR/uninitialized-zeroed.rs:50 :34
137
137
|
138
138
LL | let _val: &'static i32 = mem::uninitialized();
139
139
| ^^^^^^^^^^^^^^^^^^^^
@@ -144,7 +144,7 @@ LL | let _val: &'static i32 = mem::uninitialized();
144
144
= note: References must be non-null
145
145
146
146
error: the type `Ref` does not permit zero-initialization
147
- --> $DIR/uninitialized-zeroed.rs:51 :25
147
+ --> $DIR/uninitialized-zeroed.rs:52 :25
148
148
|
149
149
LL | let _val: Ref = mem::zeroed();
150
150
| ^^^^^^^^^^^^^
@@ -153,13 +153,13 @@ LL | let _val: Ref = mem::zeroed();
153
153
| help: use `MaybeUninit<T>` instead
154
154
|
155
155
note: References must be non-null (in this struct field)
156
- --> $DIR/uninitialized-zeroed.rs:14 :12
156
+ --> $DIR/uninitialized-zeroed.rs:15 :12
157
157
|
158
158
LL | struct Ref(&'static i32);
159
159
| ^^^^^^^^^^^^
160
160
161
161
error: the type `Ref` does not permit being left uninitialized
162
- --> $DIR/uninitialized-zeroed.rs:52 :25
162
+ --> $DIR/uninitialized-zeroed.rs:53 :25
163
163
|
164
164
LL | let _val: Ref = mem::uninitialized();
165
165
| ^^^^^^^^^^^^^^^^^^^^
@@ -168,13 +168,13 @@ LL | let _val: Ref = mem::uninitialized();
168
168
| help: use `MaybeUninit<T>` instead
169
169
|
170
170
note: References must be non-null (in this struct field)
171
- --> $DIR/uninitialized-zeroed.rs:14 :12
171
+ --> $DIR/uninitialized-zeroed.rs:15 :12
172
172
|
173
173
LL | struct Ref(&'static i32);
174
174
| ^^^^^^^^^^^^
175
175
176
176
error: the type `fn()` does not permit zero-initialization
177
- --> $DIR/uninitialized-zeroed.rs:54 :26
177
+ --> $DIR/uninitialized-zeroed.rs:55 :26
178
178
|
179
179
LL | let _val: fn() = mem::zeroed();
180
180
| ^^^^^^^^^^^^^
@@ -185,7 +185,7 @@ LL | let _val: fn() = mem::zeroed();
185
185
= note: Function pointers must be non-null
186
186
187
187
error: the type `fn()` does not permit being left uninitialized
188
- --> $DIR/uninitialized-zeroed.rs:55 :26
188
+ --> $DIR/uninitialized-zeroed.rs:56 :26
189
189
|
190
190
LL | let _val: fn() = mem::uninitialized();
191
191
| ^^^^^^^^^^^^^^^^^^^^
@@ -196,7 +196,7 @@ LL | let _val: fn() = mem::uninitialized();
196
196
= note: Function pointers must be non-null
197
197
198
198
error: the type `Wrap<fn()>` does not permit zero-initialization
199
- --> $DIR/uninitialized-zeroed.rs:57 :32
199
+ --> $DIR/uninitialized-zeroed.rs:58 :32
200
200
|
201
201
LL | let _val: Wrap<fn()> = mem::zeroed();
202
202
| ^^^^^^^^^^^^^
@@ -205,13 +205,13 @@ LL | let _val: Wrap<fn()> = mem::zeroed();
205
205
| help: use `MaybeUninit<T>` instead
206
206
|
207
207
note: Function pointers must be non-null (in this struct field)
208
- --> $DIR/uninitialized-zeroed.rs:17 :18
208
+ --> $DIR/uninitialized-zeroed.rs:18 :18
209
209
|
210
210
LL | struct Wrap<T> { wrapped: T }
211
211
| ^^^^^^^^^^
212
212
213
213
error: the type `Wrap<fn()>` does not permit being left uninitialized
214
- --> $DIR/uninitialized-zeroed.rs:58 :32
214
+ --> $DIR/uninitialized-zeroed.rs:59 :32
215
215
|
216
216
LL | let _val: Wrap<fn()> = mem::uninitialized();
217
217
| ^^^^^^^^^^^^^^^^^^^^
@@ -220,13 +220,13 @@ LL | let _val: Wrap<fn()> = mem::uninitialized();
220
220
| help: use `MaybeUninit<T>` instead
221
221
|
222
222
note: Function pointers must be non-null (in this struct field)
223
- --> $DIR/uninitialized-zeroed.rs:17 :18
223
+ --> $DIR/uninitialized-zeroed.rs:18 :18
224
224
|
225
225
LL | struct Wrap<T> { wrapped: T }
226
226
| ^^^^^^^^^^
227
227
228
228
error: the type `WrapEnum<fn()>` does not permit zero-initialization
229
- --> $DIR/uninitialized-zeroed.rs:60 :36
229
+ --> $DIR/uninitialized-zeroed.rs:61 :36
230
230
|
231
231
LL | let _val: WrapEnum<fn()> = mem::zeroed();
232
232
| ^^^^^^^^^^^^^
@@ -235,13 +235,13 @@ LL | let _val: WrapEnum<fn()> = mem::zeroed();
235
235
| help: use `MaybeUninit<T>` instead
236
236
|
237
237
note: Function pointers must be non-null (in this enum field)
238
- --> $DIR/uninitialized-zeroed.rs:18 :28
238
+ --> $DIR/uninitialized-zeroed.rs:19 :28
239
239
|
240
240
LL | enum WrapEnum<T> { Wrapped(T) }
241
241
| ^
242
242
243
243
error: the type `WrapEnum<fn()>` does not permit being left uninitialized
244
- --> $DIR/uninitialized-zeroed.rs:61 :36
244
+ --> $DIR/uninitialized-zeroed.rs:62 :36
245
245
|
246
246
LL | let _val: WrapEnum<fn()> = mem::uninitialized();
247
247
| ^^^^^^^^^^^^^^^^^^^^
@@ -250,13 +250,13 @@ LL | let _val: WrapEnum<fn()> = mem::uninitialized();
250
250
| help: use `MaybeUninit<T>` instead
251
251
|
252
252
note: Function pointers must be non-null (in this enum field)
253
- --> $DIR/uninitialized-zeroed.rs:18 :28
253
+ --> $DIR/uninitialized-zeroed.rs:19 :28
254
254
|
255
255
LL | enum WrapEnum<T> { Wrapped(T) }
256
256
| ^
257
257
258
258
error: the type `Wrap<(RefPair, i32)>` does not permit zero-initialization
259
- --> $DIR/uninitialized-zeroed.rs:63 :42
259
+ --> $DIR/uninitialized-zeroed.rs:64 :42
260
260
|
261
261
LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed();
262
262
| ^^^^^^^^^^^^^
@@ -265,13 +265,13 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed();
265
265
| help: use `MaybeUninit<T>` instead
266
266
|
267
267
note: References must be non-null (in this struct field)
268
- --> $DIR/uninitialized-zeroed.rs:15 :16
268
+ --> $DIR/uninitialized-zeroed.rs:16 :16
269
269
|
270
270
LL | struct RefPair((&'static i32, i32));
271
271
| ^^^^^^^^^^^^^^^^^^^
272
272
273
273
error: the type `Wrap<(RefPair, i32)>` does not permit being left uninitialized
274
- --> $DIR/uninitialized-zeroed.rs:64 :42
274
+ --> $DIR/uninitialized-zeroed.rs:65 :42
275
275
|
276
276
LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
277
277
| ^^^^^^^^^^^^^^^^^^^^
@@ -280,43 +280,35 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
280
280
| help: use `MaybeUninit<T>` instead
281
281
|
282
282
note: References must be non-null (in this struct field)
283
- --> $DIR/uninitialized-zeroed.rs:15 :16
283
+ --> $DIR/uninitialized-zeroed.rs:16 :16
284
284
|
285
285
LL | struct RefPair((&'static i32, i32));
286
286
| ^^^^^^^^^^^^^^^^^^^
287
287
288
- error: the type `std::vec::Vec<i32>` does not permit zero-initialization
289
- --> $DIR/uninitialized-zeroed.rs:66:30
290
- |
291
- LL | let _val: Vec<i32> = mem::zeroed();
292
- | ^^^^^^^^^^^^^
293
- | |
294
- | this code causes undefined behavior when executed
295
- | help: use `MaybeUninit<T>` instead
288
+ error: the type `std::ptr::NonNull<i32>` does not permit zero-initialization
289
+ --> $DIR/uninitialized-zeroed.rs:67:34
296
290
|
297
- note: std::ptr::Unique<i32> must be non-null (in this struct field)
298
- --> $SRC_DIR/liballoc/raw_vec.rs:LL:COL
291
+ LL | let _val: NonNull<i32> = mem::zeroed();
292
+ | ^^^^^^^^^^^^^
293
+ | |
294
+ | this code causes undefined behavior when executed
295
+ | help: use `MaybeUninit<T>` instead
299
296
|
300
- LL | ptr: Unique<T>,
301
- | ^^^^^^^^^^^^^^
297
+ = note: std::ptr::NonNull<i32> must be non-null
302
298
303
- error: the type `std::vec::Vec<i32>` does not permit being left uninitialized
304
- --> $DIR/uninitialized-zeroed.rs:67:30
305
- |
306
- LL | let _val: Vec<i32> = mem::uninitialized();
307
- | ^^^^^^^^^^^^^^^^^^^^
308
- | |
309
- | this code causes undefined behavior when executed
310
- | help: use `MaybeUninit<T>` instead
299
+ error: the type `std::ptr::NonNull<i32>` does not permit being left uninitialized
300
+ --> $DIR/uninitialized-zeroed.rs:68:34
311
301
|
312
- note: std::ptr::Unique<i32> must be non-null (in this struct field)
313
- --> $SRC_DIR/liballoc/raw_vec.rs:LL:COL
302
+ LL | let _val: NonNull<i32> = mem::uninitialized();
303
+ | ^^^^^^^^^^^^^^^^^^^^
304
+ | |
305
+ | this code causes undefined behavior when executed
306
+ | help: use `MaybeUninit<T>` instead
314
307
|
315
- LL | ptr: Unique<T>,
316
- | ^^^^^^^^^^^^^^
308
+ = note: std::ptr::NonNull<i32> must be non-null
317
309
318
310
error: the type `bool` does not permit being left uninitialized
319
- --> $DIR/uninitialized-zeroed.rs:71 :26
311
+ --> $DIR/uninitialized-zeroed.rs:72 :26
320
312
|
321
313
LL | let _val: bool = mem::uninitialized();
322
314
| ^^^^^^^^^^^^^^^^^^^^
@@ -327,7 +319,7 @@ LL | let _val: bool = mem::uninitialized();
327
319
= note: Booleans must be `true` or `false`
328
320
329
321
error: the type `Wrap<char>` does not permit being left uninitialized
330
- --> $DIR/uninitialized-zeroed.rs:74 :32
322
+ --> $DIR/uninitialized-zeroed.rs:75 :32
331
323
|
332
324
LL | let _val: Wrap<char> = mem::uninitialized();
333
325
| ^^^^^^^^^^^^^^^^^^^^
@@ -336,13 +328,13 @@ LL | let _val: Wrap<char> = mem::uninitialized();
336
328
| help: use `MaybeUninit<T>` instead
337
329
|
338
330
note: Characters must be a valid unicode codepoint (in this struct field)
339
- --> $DIR/uninitialized-zeroed.rs:17 :18
331
+ --> $DIR/uninitialized-zeroed.rs:18 :18
340
332
|
341
333
LL | struct Wrap<T> { wrapped: T }
342
334
| ^^^^^^^^^^
343
335
344
336
error: the type `NonBig` does not permit being left uninitialized
345
- --> $DIR/uninitialized-zeroed.rs:77 :28
337
+ --> $DIR/uninitialized-zeroed.rs:78 :28
346
338
|
347
339
LL | let _val: NonBig = mem::uninitialized();
348
340
| ^^^^^^^^^^^^^^^^^^^^
@@ -353,7 +345,7 @@ LL | let _val: NonBig = mem::uninitialized();
353
345
= note: NonBig must be initialized inside its custom valid range
354
346
355
347
error: the type `&'static i32` does not permit zero-initialization
356
- --> $DIR/uninitialized-zeroed.rs:80 :34
348
+ --> $DIR/uninitialized-zeroed.rs:81 :34
357
349
|
358
350
LL | let _val: &'static i32 = mem::transmute(0usize);
359
351
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -364,7 +356,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize);
364
356
= note: References must be non-null
365
357
366
358
error: the type `&'static [i32]` does not permit zero-initialization
367
- --> $DIR/uninitialized-zeroed.rs:81 :36
359
+ --> $DIR/uninitialized-zeroed.rs:82 :36
368
360
|
369
361
LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
370
362
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -375,7 +367,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
375
367
= note: References must be non-null
376
368
377
369
error: the type `std::num::NonZeroU32` does not permit zero-initialization
378
- --> $DIR/uninitialized-zeroed.rs:82 :32
370
+ --> $DIR/uninitialized-zeroed.rs:83 :32
379
371
|
380
372
LL | let _val: NonZeroU32 = mem::transmute(0);
381
373
| ^^^^^^^^^^^^^^^^^
0 commit comments