1
1
error: the type `&'static T` does not permit zero-initialization
2
- --> $DIR/uninitialized-zeroed.rs:22 :32
2
+ --> $DIR/uninitialized-zeroed.rs:27 :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:23 :32
18
+ --> $DIR/uninitialized-zeroed.rs:28 :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:25 :38
29
+ --> $DIR/uninitialized-zeroed.rs:30 :38
30
30
|
31
31
LL | let _val: Wrap<&'static T> = mem::zeroed();
32
32
| ^^^^^^^^^^^^^
@@ -41,7 +41,7 @@ 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:26 :38
44
+ --> $DIR/uninitialized-zeroed.rs:31 :38
45
45
|
46
46
LL | let _val: Wrap<&'static T> = mem::uninitialized();
47
47
| ^^^^^^^^^^^^^^^^^^^^
@@ -56,7 +56,7 @@ 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:32 :23
59
+ --> $DIR/uninitialized-zeroed.rs:38 :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:33 :23
70
+ --> $DIR/uninitialized-zeroed.rs:39 :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:35 :30
81
+ --> $DIR/uninitialized-zeroed.rs:41 :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:36 :30
92
+ --> $DIR/uninitialized-zeroed.rs:42 :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:38 :26
103
+ --> $DIR/uninitialized-zeroed.rs:44 :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:39 :26
114
+ --> $DIR/uninitialized-zeroed.rs:45 :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:41 :34
125
+ --> $DIR/uninitialized-zeroed.rs:47 :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:42 :34
136
+ --> $DIR/uninitialized-zeroed.rs:48 :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:44 :25
147
+ --> $DIR/uninitialized-zeroed.rs:50 :25
148
148
|
149
149
LL | let _val: Ref = mem::zeroed();
150
150
| ^^^^^^^^^^^^^
@@ -159,7 +159,7 @@ 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:45 :25
162
+ --> $DIR/uninitialized-zeroed.rs:51 :25
163
163
|
164
164
LL | let _val: Ref = mem::uninitialized();
165
165
| ^^^^^^^^^^^^^^^^^^^^
@@ -174,7 +174,7 @@ 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:47 :26
177
+ --> $DIR/uninitialized-zeroed.rs:53 :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:48 :26
188
+ --> $DIR/uninitialized-zeroed.rs:54 :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:50 :32
199
+ --> $DIR/uninitialized-zeroed.rs:56 :32
200
200
|
201
201
LL | let _val: Wrap<fn()> = mem::zeroed();
202
202
| ^^^^^^^^^^^^^
@@ -211,7 +211,7 @@ 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:51 :32
214
+ --> $DIR/uninitialized-zeroed.rs:57 :32
215
215
|
216
216
LL | let _val: Wrap<fn()> = mem::uninitialized();
217
217
| ^^^^^^^^^^^^^^^^^^^^
@@ -226,7 +226,7 @@ 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:53 :36
229
+ --> $DIR/uninitialized-zeroed.rs:59 :36
230
230
|
231
231
LL | let _val: WrapEnum<fn()> = mem::zeroed();
232
232
| ^^^^^^^^^^^^^
@@ -241,7 +241,7 @@ 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:54 :36
244
+ --> $DIR/uninitialized-zeroed.rs:60 :36
245
245
|
246
246
LL | let _val: WrapEnum<fn()> = mem::uninitialized();
247
247
| ^^^^^^^^^^^^^^^^^^^^
@@ -256,7 +256,7 @@ 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:56 :42
259
+ --> $DIR/uninitialized-zeroed.rs:62 :42
260
260
|
261
261
LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed();
262
262
| ^^^^^^^^^^^^^
@@ -271,7 +271,7 @@ 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:57 :42
274
+ --> $DIR/uninitialized-zeroed.rs:63 :42
275
275
|
276
276
LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
277
277
| ^^^^^^^^^^^^^^^^^^^^
@@ -285,8 +285,38 @@ note: References must be non-null (in this struct field)
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:65: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
296
+ |
297
+ note: std::ptr::Unique<i32> must be non-null (in this struct field)
298
+ --> $SRC_DIR/liballoc/raw_vec.rs:LL:COL
299
+ |
300
+ LL | ptr: Unique<T>,
301
+ | ^^^^^^^^^^^^^^
302
+
303
+ error: the type `std::vec::Vec<i32>` does not permit being left uninitialized
304
+ --> $DIR/uninitialized-zeroed.rs:66: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
311
+ |
312
+ note: std::ptr::Unique<i32> must be non-null (in this struct field)
313
+ --> $SRC_DIR/liballoc/raw_vec.rs:LL:COL
314
+ |
315
+ LL | ptr: Unique<T>,
316
+ | ^^^^^^^^^^^^^^
317
+
288
318
error: the type `bool` does not permit being left uninitialized
289
- --> $DIR/uninitialized-zeroed.rs:59 :26
319
+ --> $DIR/uninitialized-zeroed.rs:70 :26
290
320
|
291
321
LL | let _val: bool = mem::uninitialized();
292
322
| ^^^^^^^^^^^^^^^^^^^^
@@ -297,7 +327,7 @@ LL | let _val: bool = mem::uninitialized();
297
327
= note: Booleans must be `true` or `false`
298
328
299
329
error: the type `Wrap<char>` does not permit being left uninitialized
300
- --> $DIR/uninitialized-zeroed.rs:60 :32
330
+ --> $DIR/uninitialized-zeroed.rs:73 :32
301
331
|
302
332
LL | let _val: Wrap<char> = mem::uninitialized();
303
333
| ^^^^^^^^^^^^^^^^^^^^
@@ -311,5 +341,16 @@ note: Characters must be a valid unicode codepoint (in this struct field)
311
341
LL | struct Wrap<T> { wrapped: T }
312
342
| ^^^^^^^^^^
313
343
314
- error: aborting due to 24 previous errors
344
+ error: the type `NonBig` does not permit being left uninitialized
345
+ --> $DIR/uninitialized-zeroed.rs:76:28
346
+ |
347
+ LL | let _val: NonBig = mem::uninitialized();
348
+ | ^^^^^^^^^^^^^^^^^^^^
349
+ | |
350
+ | this code causes undefined behavior when executed
351
+ | help: use `MaybeUninit<T>` instead
352
+ |
353
+ = note: NonBig must be initialized inside its custom valid range
354
+
355
+ error: aborting due to 27 previous errors
315
356
0 commit comments