@@ -5,7 +5,7 @@ LL | let _val: &'static T = mem::zeroed();
5
5
| ^^^^^^^^^^^^^
6
6
| |
7
7
| this code causes undefined behavior when executed
8
- | help: use `MaybeUninit<T>` instead
8
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
9
9
|
10
10
note: lint level defined here
11
11
--> $DIR/uninitialized-zeroed.rs:7:9
@@ -21,7 +21,7 @@ LL | let _val: &'static T = mem::uninitialized();
21
21
| ^^^^^^^^^^^^^^^^^^^^
22
22
| |
23
23
| this code causes undefined behavior when executed
24
- | help: use `MaybeUninit<T>` instead
24
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
25
25
|
26
26
= note: References must be non-null
27
27
@@ -32,7 +32,7 @@ LL | let _val: Wrap<&'static T> = mem::zeroed();
32
32
| ^^^^^^^^^^^^^
33
33
| |
34
34
| this code causes undefined behavior when executed
35
- | help: use `MaybeUninit<T>` instead
35
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
36
36
|
37
37
note: References must be non-null (in this struct field)
38
38
--> $DIR/uninitialized-zeroed.rs:18:18
@@ -47,7 +47,7 @@ LL | let _val: Wrap<&'static T> = mem::uninitialized();
47
47
| ^^^^^^^^^^^^^^^^^^^^
48
48
| |
49
49
| this code causes undefined behavior when executed
50
- | help: use `MaybeUninit<T>` instead
50
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
51
51
|
52
52
note: References must be non-null (in this struct field)
53
53
--> $DIR/uninitialized-zeroed.rs:18:18
@@ -62,7 +62,7 @@ LL | let _val: ! = mem::zeroed();
62
62
| ^^^^^^^^^^^^^
63
63
| |
64
64
| this code causes undefined behavior when executed
65
- | help: use `MaybeUninit<T>` instead
65
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
66
66
|
67
67
= note: The never type (`!`) has no valid value
68
68
@@ -73,7 +73,7 @@ LL | let _val: ! = mem::uninitialized();
73
73
| ^^^^^^^^^^^^^^^^^^^^
74
74
| |
75
75
| this code causes undefined behavior when executed
76
- | help: use `MaybeUninit<T>` instead
76
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
77
77
|
78
78
= note: The never type (`!`) has no valid value
79
79
@@ -84,7 +84,7 @@ LL | let _val: (i32, !) = mem::zeroed();
84
84
| ^^^^^^^^^^^^^
85
85
| |
86
86
| this code causes undefined behavior when executed
87
- | help: use `MaybeUninit<T>` instead
87
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
88
88
|
89
89
= note: The never type (`!`) has no valid value
90
90
@@ -95,7 +95,7 @@ LL | let _val: (i32, !) = mem::uninitialized();
95
95
| ^^^^^^^^^^^^^^^^^^^^
96
96
| |
97
97
| this code causes undefined behavior when executed
98
- | help: use `MaybeUninit<T>` instead
98
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
99
99
|
100
100
= note: The never type (`!`) has no valid value
101
101
@@ -106,7 +106,7 @@ LL | let _val: Void = mem::zeroed();
106
106
| ^^^^^^^^^^^^^
107
107
| |
108
108
| this code causes undefined behavior when executed
109
- | help: use `MaybeUninit<T>` instead
109
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
110
110
|
111
111
= note: 0-variant enums have no valid value
112
112
@@ -117,7 +117,7 @@ LL | let _val: Void = mem::uninitialized();
117
117
| ^^^^^^^^^^^^^^^^^^^^
118
118
| |
119
119
| this code causes undefined behavior when executed
120
- | help: use `MaybeUninit<T>` instead
120
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
121
121
|
122
122
= note: 0-variant enums have no valid value
123
123
@@ -128,7 +128,7 @@ LL | let _val: &'static i32 = mem::zeroed();
128
128
| ^^^^^^^^^^^^^
129
129
| |
130
130
| this code causes undefined behavior when executed
131
- | help: use `MaybeUninit<T>` instead
131
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
132
132
|
133
133
= note: References must be non-null
134
134
@@ -139,7 +139,7 @@ LL | let _val: &'static i32 = mem::uninitialized();
139
139
| ^^^^^^^^^^^^^^^^^^^^
140
140
| |
141
141
| this code causes undefined behavior when executed
142
- | help: use `MaybeUninit<T>` instead
142
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
143
143
|
144
144
= note: References must be non-null
145
145
@@ -150,7 +150,7 @@ LL | let _val: Ref = mem::zeroed();
150
150
| ^^^^^^^^^^^^^
151
151
| |
152
152
| this code causes undefined behavior when executed
153
- | help: use `MaybeUninit<T>` instead
153
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
154
154
|
155
155
note: References must be non-null (in this struct field)
156
156
--> $DIR/uninitialized-zeroed.rs:15:12
@@ -165,7 +165,7 @@ LL | let _val: Ref = mem::uninitialized();
165
165
| ^^^^^^^^^^^^^^^^^^^^
166
166
| |
167
167
| this code causes undefined behavior when executed
168
- | help: use `MaybeUninit<T>` instead
168
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
169
169
|
170
170
note: References must be non-null (in this struct field)
171
171
--> $DIR/uninitialized-zeroed.rs:15:12
@@ -180,7 +180,7 @@ LL | let _val: fn() = mem::zeroed();
180
180
| ^^^^^^^^^^^^^
181
181
| |
182
182
| this code causes undefined behavior when executed
183
- | help: use `MaybeUninit<T>` instead
183
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
184
184
|
185
185
= note: Function pointers must be non-null
186
186
@@ -191,7 +191,7 @@ LL | let _val: fn() = mem::uninitialized();
191
191
| ^^^^^^^^^^^^^^^^^^^^
192
192
| |
193
193
| this code causes undefined behavior when executed
194
- | help: use `MaybeUninit<T>` instead
194
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
195
195
|
196
196
= note: Function pointers must be non-null
197
197
@@ -202,7 +202,7 @@ LL | let _val: Wrap<fn()> = mem::zeroed();
202
202
| ^^^^^^^^^^^^^
203
203
| |
204
204
| this code causes undefined behavior when executed
205
- | help: use `MaybeUninit<T>` instead
205
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
206
206
|
207
207
note: Function pointers must be non-null (in this struct field)
208
208
--> $DIR/uninitialized-zeroed.rs:18:18
@@ -217,7 +217,7 @@ LL | let _val: Wrap<fn()> = mem::uninitialized();
217
217
| ^^^^^^^^^^^^^^^^^^^^
218
218
| |
219
219
| this code causes undefined behavior when executed
220
- | help: use `MaybeUninit<T>` instead
220
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
221
221
|
222
222
note: Function pointers must be non-null (in this struct field)
223
223
--> $DIR/uninitialized-zeroed.rs:18:18
@@ -232,7 +232,7 @@ LL | let _val: WrapEnum<fn()> = mem::zeroed();
232
232
| ^^^^^^^^^^^^^
233
233
| |
234
234
| this code causes undefined behavior when executed
235
- | help: use `MaybeUninit<T>` instead
235
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
236
236
|
237
237
note: Function pointers must be non-null (in this enum field)
238
238
--> $DIR/uninitialized-zeroed.rs:19:28
@@ -247,7 +247,7 @@ LL | let _val: WrapEnum<fn()> = mem::uninitialized();
247
247
| ^^^^^^^^^^^^^^^^^^^^
248
248
| |
249
249
| this code causes undefined behavior when executed
250
- | help: use `MaybeUninit<T>` instead
250
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
251
251
|
252
252
note: Function pointers must be non-null (in this enum field)
253
253
--> $DIR/uninitialized-zeroed.rs:19:28
@@ -262,7 +262,7 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed();
262
262
| ^^^^^^^^^^^^^
263
263
| |
264
264
| this code causes undefined behavior when executed
265
- | help: use `MaybeUninit<T>` instead
265
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
266
266
|
267
267
note: References must be non-null (in this struct field)
268
268
--> $DIR/uninitialized-zeroed.rs:16:16
@@ -277,7 +277,7 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
277
277
| ^^^^^^^^^^^^^^^^^^^^
278
278
| |
279
279
| this code causes undefined behavior when executed
280
- | help: use `MaybeUninit<T>` instead
280
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
281
281
|
282
282
note: References must be non-null (in this struct field)
283
283
--> $DIR/uninitialized-zeroed.rs:16:16
@@ -292,7 +292,7 @@ LL | let _val: NonNull<i32> = mem::zeroed();
292
292
| ^^^^^^^^^^^^^
293
293
| |
294
294
| this code causes undefined behavior when executed
295
- | help: use `MaybeUninit<T>` instead
295
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
296
296
|
297
297
= note: std::ptr::NonNull<i32> must be non-null
298
298
@@ -303,7 +303,7 @@ LL | let _val: NonNull<i32> = mem::uninitialized();
303
303
| ^^^^^^^^^^^^^^^^^^^^
304
304
| |
305
305
| this code causes undefined behavior when executed
306
- | help: use `MaybeUninit<T>` instead
306
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
307
307
|
308
308
= note: std::ptr::NonNull<i32> must be non-null
309
309
@@ -314,7 +314,7 @@ LL | let _val: *const dyn Send = mem::zeroed();
314
314
| ^^^^^^^^^^^^^
315
315
| |
316
316
| this code causes undefined behavior when executed
317
- | help: use `MaybeUninit<T>` instead
317
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
318
318
|
319
319
= note: The vtable of a wide raw pointer must be non-null
320
320
@@ -325,7 +325,7 @@ LL | let _val: *const dyn Send = mem::uninitialized();
325
325
| ^^^^^^^^^^^^^^^^^^^^
326
326
| |
327
327
| this code causes undefined behavior when executed
328
- | help: use `MaybeUninit<T>` instead
328
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
329
329
|
330
330
= note: The vtable of a wide raw pointer must be non-null
331
331
@@ -336,7 +336,7 @@ LL | let _val: bool = mem::uninitialized();
336
336
| ^^^^^^^^^^^^^^^^^^^^
337
337
| |
338
338
| this code causes undefined behavior when executed
339
- | help: use `MaybeUninit<T>` instead
339
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
340
340
|
341
341
= note: Booleans must be `true` or `false`
342
342
@@ -347,7 +347,7 @@ LL | let _val: Wrap<char> = mem::uninitialized();
347
347
| ^^^^^^^^^^^^^^^^^^^^
348
348
| |
349
349
| this code causes undefined behavior when executed
350
- | help: use `MaybeUninit<T>` instead
350
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
351
351
|
352
352
note: Characters must be a valid unicode codepoint (in this struct field)
353
353
--> $DIR/uninitialized-zeroed.rs:18:18
@@ -362,7 +362,7 @@ LL | let _val: NonBig = mem::uninitialized();
362
362
| ^^^^^^^^^^^^^^^^^^^^
363
363
| |
364
364
| this code causes undefined behavior when executed
365
- | help: use `MaybeUninit<T>` instead
365
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
366
366
|
367
367
= note: NonBig must be initialized inside its custom valid range
368
368
@@ -373,7 +373,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize);
373
373
| ^^^^^^^^^^^^^^^^^^^^^^
374
374
| |
375
375
| this code causes undefined behavior when executed
376
- | help: use `MaybeUninit<T>` instead
376
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
377
377
|
378
378
= note: References must be non-null
379
379
@@ -384,7 +384,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
384
384
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
385
385
| |
386
386
| this code causes undefined behavior when executed
387
- | help: use `MaybeUninit<T>` instead
387
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
388
388
|
389
389
= note: References must be non-null
390
390
@@ -395,7 +395,7 @@ LL | let _val: NonZeroU32 = mem::transmute(0);
395
395
| ^^^^^^^^^^^^^^^^^
396
396
| |
397
397
| this code causes undefined behavior when executed
398
- | help: use `MaybeUninit<T>` instead
398
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
399
399
|
400
400
= note: std::num::NonZeroU32 must be non-null
401
401
@@ -406,7 +406,7 @@ LL | let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init();
406
406
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
407
407
| |
408
408
| this code causes undefined behavior when executed
409
- | help: use `MaybeUninit<T>` instead
409
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
410
410
|
411
411
= note: std::ptr::NonNull<i32> must be non-null
412
412
@@ -417,7 +417,7 @@ LL | let _val: NonNull<i32> = MaybeUninit::uninit().assume_init();
417
417
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
418
418
| |
419
419
| this code causes undefined behavior when executed
420
- | help: use `MaybeUninit<T>` instead
420
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
421
421
|
422
422
= note: std::ptr::NonNull<i32> must be non-null
423
423
@@ -428,7 +428,7 @@ LL | let _val: bool = MaybeUninit::uninit().assume_init();
428
428
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
429
429
| |
430
430
| this code causes undefined behavior when executed
431
- | help: use `MaybeUninit<T>` instead
431
+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
432
432
|
433
433
= note: Booleans must be `true` or `false`
434
434
0 commit comments