fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
28.5 KiB652 linesraw
1error: the type `&T` does not permit zero-initialization
2  --> $DIR/invalid_value.rs:54:32
3   |
4LL |         let _val: &'static T = mem::zeroed();
5   |                                ^^^^^^^^^^^^^
6   |                                |
7   |                                this code causes undefined behavior when executed
8   |                                help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
9   |
10   = note: references must be non-null
11note: the lint level is defined here
12  --> $DIR/invalid_value.rs:6:9
13   |
14LL | #![deny(invalid_value)]
15   |         ^^^^^^^^^^^^^
16
17error: the type `&T` does not permit being left uninitialized
18  --> $DIR/invalid_value.rs:55:32
19   |
20LL |         let _val: &'static T = mem::uninitialized();
21   |                                ^^^^^^^^^^^^^^^^^^^^
22   |                                |
23   |                                this code causes undefined behavior when executed
24   |                                help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
25   |
26   = note: references must be non-null
27
28error: the type `Wrap<&T>` does not permit zero-initialization
29  --> $DIR/invalid_value.rs:57:38
30   |
31LL |         let _val: Wrap<&'static T> = mem::zeroed();
32   |                                      ^^^^^^^^^^^^^
33   |                                      |
34   |                                      this code causes undefined behavior when executed
35   |                                      help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
36   |
37   = note: `Wrap<&T>` must be non-null
38note: because references must be non-null (in this struct field)
39  --> $DIR/invalid_value.rs:17:18
40   |
41LL | struct Wrap<T> { wrapped: T }
42   |                  ^^^^^^^^^^
43
44error: the type `Wrap<&T>` does not permit being left uninitialized
45  --> $DIR/invalid_value.rs:58:38
46   |
47LL |         let _val: Wrap<&'static T> = mem::uninitialized();
48   |                                      ^^^^^^^^^^^^^^^^^^^^
49   |                                      |
50   |                                      this code causes undefined behavior when executed
51   |                                      help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
52   |
53   = note: `Wrap<&T>` must be non-null
54note: because references must be non-null (in this struct field)
55  --> $DIR/invalid_value.rs:17:18
56   |
57LL | struct Wrap<T> { wrapped: T }
58   |                  ^^^^^^^^^^
59
60error: the type `!` does not permit zero-initialization
61  --> $DIR/invalid_value.rs:65:23
62   |
63LL |         let _val: ! = mem::zeroed();
64   |                       ^^^^^^^^^^^^^ this code causes undefined behavior when executed
65   |
66   = note: the `!` type has no valid value
67
68error: the type `!` does not permit being left uninitialized
69  --> $DIR/invalid_value.rs:66:23
70   |
71LL |         let _val: ! = mem::uninitialized();
72   |                       ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
73   |
74   = note: the `!` type has no valid value
75
76error: the type `(i32, !)` does not permit zero-initialization
77  --> $DIR/invalid_value.rs:68:30
78   |
79LL |         let _val: (i32, !) = mem::zeroed();
80   |                              ^^^^^^^^^^^^^ this code causes undefined behavior when executed
81   |
82   = note: the `!` type has no valid value
83
84error: the type `(i32, !)` does not permit being left uninitialized
85  --> $DIR/invalid_value.rs:69:30
86   |
87LL |         let _val: (i32, !) = mem::uninitialized();
88   |                              ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
89   |
90   = note: integers must be initialized
91
92error: the type `Void` does not permit zero-initialization
93  --> $DIR/invalid_value.rs:71:26
94   |
95LL |         let _val: Void = mem::zeroed();
96   |                          ^^^^^^^^^^^^^ this code causes undefined behavior when executed
97   |
98note: enums with no inhabited variants have no valid value
99  --> $DIR/invalid_value.rs:12:1
100   |
101LL | enum Void {}
102   | ^^^^^^^^^
103
104error: the type `Void` does not permit being left uninitialized
105  --> $DIR/invalid_value.rs:72:26
106   |
107LL |         let _val: Void = mem::uninitialized();
108   |                          ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
109   |
110note: enums with no inhabited variants have no valid value
111  --> $DIR/invalid_value.rs:12:1
112   |
113LL | enum Void {}
114   | ^^^^^^^^^
115
116error: the type `&i32` does not permit zero-initialization
117  --> $DIR/invalid_value.rs:74:34
118   |
119LL |         let _val: &'static i32 = mem::zeroed();
120   |                                  ^^^^^^^^^^^^^
121   |                                  |
122   |                                  this code causes undefined behavior when executed
123   |                                  help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
124   |
125   = note: references must be non-null
126
127error: the type `&i32` does not permit being left uninitialized
128  --> $DIR/invalid_value.rs:75:34
129   |
130LL |         let _val: &'static i32 = mem::uninitialized();
131   |                                  ^^^^^^^^^^^^^^^^^^^^
132   |                                  |
133   |                                  this code causes undefined behavior when executed
134   |                                  help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
135   |
136   = note: references must be non-null
137
138error: the type `Ref` does not permit zero-initialization
139  --> $DIR/invalid_value.rs:77:25
140   |
141LL |         let _val: Ref = mem::zeroed();
142   |                         ^^^^^^^^^^^^^
143   |                         |
144   |                         this code causes undefined behavior when executed
145   |                         help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
146   |
147   = note: `Ref` must be non-null
148note: because references must be non-null (in this struct field)
149  --> $DIR/invalid_value.rs:14:12
150   |
151LL | struct Ref(&'static i32);
152   |            ^^^^^^^^^^^^
153
154error: the type `Ref` does not permit being left uninitialized
155  --> $DIR/invalid_value.rs:78:25
156   |
157LL |         let _val: Ref = mem::uninitialized();
158   |                         ^^^^^^^^^^^^^^^^^^^^
159   |                         |
160   |                         this code causes undefined behavior when executed
161   |                         help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
162   |
163   = note: `Ref` must be non-null
164note: because references must be non-null (in this struct field)
165  --> $DIR/invalid_value.rs:14:12
166   |
167LL | struct Ref(&'static i32);
168   |            ^^^^^^^^^^^^
169
170error: the type `fn()` does not permit zero-initialization
171  --> $DIR/invalid_value.rs:80:26
172   |
173LL |         let _val: fn() = mem::zeroed();
174   |                          ^^^^^^^^^^^^^
175   |                          |
176   |                          this code causes undefined behavior when executed
177   |                          help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
178   |
179   = note: function pointers must be non-null
180
181error: the type `fn()` does not permit being left uninitialized
182  --> $DIR/invalid_value.rs:81:26
183   |
184LL |         let _val: fn() = mem::uninitialized();
185   |                          ^^^^^^^^^^^^^^^^^^^^
186   |                          |
187   |                          this code causes undefined behavior when executed
188   |                          help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
189   |
190   = note: function pointers must be non-null
191
192error: the type `Wrap<fn()>` does not permit zero-initialization
193  --> $DIR/invalid_value.rs:83:32
194   |
195LL |         let _val: Wrap<fn()> = mem::zeroed();
196   |                                ^^^^^^^^^^^^^
197   |                                |
198   |                                this code causes undefined behavior when executed
199   |                                help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
200   |
201   = note: `Wrap<fn()>` must be non-null
202note: because function pointers must be non-null (in this struct field)
203  --> $DIR/invalid_value.rs:17:18
204   |
205LL | struct Wrap<T> { wrapped: T }
206   |                  ^^^^^^^^^^
207
208error: the type `Wrap<fn()>` does not permit being left uninitialized
209  --> $DIR/invalid_value.rs:84:32
210   |
211LL |         let _val: Wrap<fn()> = mem::uninitialized();
212   |                                ^^^^^^^^^^^^^^^^^^^^
213   |                                |
214   |                                this code causes undefined behavior when executed
215   |                                help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
216   |
217   = note: `Wrap<fn()>` must be non-null
218note: because function pointers must be non-null (in this struct field)
219  --> $DIR/invalid_value.rs:17:18
220   |
221LL | struct Wrap<T> { wrapped: T }
222   |                  ^^^^^^^^^^
223
224error: the type `WrapEnum<fn()>` does not permit zero-initialization
225  --> $DIR/invalid_value.rs:86:36
226   |
227LL |         let _val: WrapEnum<fn()> = mem::zeroed();
228   |                                    ^^^^^^^^^^^^^
229   |                                    |
230   |                                    this code causes undefined behavior when executed
231   |                                    help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
232   |
233   = note: `WrapEnum<fn()>` must be non-null
234note: because function pointers must be non-null (in this field of the only potentially inhabited enum variant)
235  --> $DIR/invalid_value.rs:18:28
236   |
237LL | enum WrapEnum<T> { Wrapped(T) }
238   |                            ^
239
240error: the type `WrapEnum<fn()>` does not permit being left uninitialized
241  --> $DIR/invalid_value.rs:87:36
242   |
243LL |         let _val: WrapEnum<fn()> = mem::uninitialized();
244   |                                    ^^^^^^^^^^^^^^^^^^^^
245   |                                    |
246   |                                    this code causes undefined behavior when executed
247   |                                    help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
248   |
249   = note: `WrapEnum<fn()>` must be non-null
250note: because function pointers must be non-null (in this field of the only potentially inhabited enum variant)
251  --> $DIR/invalid_value.rs:18:28
252   |
253LL | enum WrapEnum<T> { Wrapped(T) }
254   |                            ^
255
256error: the type `Wrap<(RefPair, i32)>` does not permit zero-initialization
257  --> $DIR/invalid_value.rs:89:42
258   |
259LL |         let _val: Wrap<(RefPair, i32)> = mem::zeroed();
260   |                                          ^^^^^^^^^^^^^
261   |                                          |
262   |                                          this code causes undefined behavior when executed
263   |                                          help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
264   |
265note: `RefPair` must be non-null (in this struct field)
266  --> $DIR/invalid_value.rs:17:18
267   |
268LL | struct Wrap<T> { wrapped: T }
269   |                  ^^^^^^^^^^
270note: because references must be non-null (in this struct field)
271  --> $DIR/invalid_value.rs:15:16
272   |
273LL | struct RefPair((&'static i32, i32));
274   |                ^^^^^^^^^^^^^^^^^^^
275
276error: the type `Wrap<(RefPair, i32)>` does not permit being left uninitialized
277  --> $DIR/invalid_value.rs:90:42
278   |
279LL |         let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
280   |                                          ^^^^^^^^^^^^^^^^^^^^
281   |                                          |
282   |                                          this code causes undefined behavior when executed
283   |                                          help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
284   |
285note: `RefPair` must be non-null (in this struct field)
286  --> $DIR/invalid_value.rs:17:18
287   |
288LL | struct Wrap<T> { wrapped: T }
289   |                  ^^^^^^^^^^
290note: because references must be non-null (in this struct field)
291  --> $DIR/invalid_value.rs:15:16
292   |
293LL | struct RefPair((&'static i32, i32));
294   |                ^^^^^^^^^^^^^^^^^^^
295
296error: the type `NonNull<i32>` does not permit zero-initialization
297  --> $DIR/invalid_value.rs:92:34
298   |
299LL |         let _val: NonNull<i32> = mem::zeroed();
300   |                                  ^^^^^^^^^^^^^
301   |                                  |
302   |                                  this code causes undefined behavior when executed
303   |                                  help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
304   |
305   = note: `std::ptr::NonNull<i32>` must be non-null
306
307error: the type `NonNull<i32>` does not permit being left uninitialized
308  --> $DIR/invalid_value.rs:93:34
309   |
310LL |         let _val: NonNull<i32> = mem::uninitialized();
311   |                                  ^^^^^^^^^^^^^^^^^^^^
312   |                                  |
313   |                                  this code causes undefined behavior when executed
314   |                                  help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
315   |
316   = note: `std::ptr::NonNull<i32>` must be non-null
317   = note: raw pointers must be initialized
318
319error: the type `(NonZeroU32, i32)` does not permit zero-initialization
320  --> $DIR/invalid_value.rs:95:39
321   |
322LL |         let _val: (NonZeroU32, i32) = mem::zeroed();
323   |                                       ^^^^^^^^^^^^^
324   |                                       |
325   |                                       this code causes undefined behavior when executed
326   |                                       help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
327   |
328   = note: `std::num::NonZeroU32` must be non-null
329
330error: the type `(NonZeroU32, i32)` does not permit being left uninitialized
331  --> $DIR/invalid_value.rs:96:39
332   |
333LL |         let _val: (NonZeroU32, i32) = mem::uninitialized();
334   |                                       ^^^^^^^^^^^^^^^^^^^^
335   |                                       |
336   |                                       this code causes undefined behavior when executed
337   |                                       help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
338   |
339   = note: `std::num::NonZeroU32` must be non-null
340   = note: integers must be initialized
341
342error: the type `*const dyn Send` does not permit zero-initialization
343  --> $DIR/invalid_value.rs:98:37
344   |
345LL |         let _val: *const dyn Send = mem::zeroed();
346   |                                     ^^^^^^^^^^^^^
347   |                                     |
348   |                                     this code causes undefined behavior when executed
349   |                                     help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
350   |
351   = note: the vtable of a wide raw pointer must be non-null
352
353error: the type `*const dyn Send` does not permit being left uninitialized
354  --> $DIR/invalid_value.rs:99:37
355   |
356LL |         let _val: *const dyn Send = mem::uninitialized();
357   |                                     ^^^^^^^^^^^^^^^^^^^^
358   |                                     |
359   |                                     this code causes undefined behavior when executed
360   |                                     help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
361   |
362   = note: the vtable of a wide raw pointer must be non-null
363
364error: the type `[fn(); 2]` does not permit zero-initialization
365  --> $DIR/invalid_value.rs:101:31
366   |
367LL |         let _val: [fn(); 2] = mem::zeroed();
368   |                               ^^^^^^^^^^^^^
369   |                               |
370   |                               this code causes undefined behavior when executed
371   |                               help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
372   |
373   = note: function pointers must be non-null
374
375error: the type `[fn(); 2]` does not permit being left uninitialized
376  --> $DIR/invalid_value.rs:102:31
377   |
378LL |         let _val: [fn(); 2] = mem::uninitialized();
379   |                               ^^^^^^^^^^^^^^^^^^^^
380   |                               |
381   |                               this code causes undefined behavior when executed
382   |                               help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
383   |
384   = note: function pointers must be non-null
385
386error: the type `TwoUninhabited` does not permit zero-initialization
387  --> $DIR/invalid_value.rs:104:36
388   |
389LL |         let _val: TwoUninhabited = mem::zeroed();
390   |                                    ^^^^^^^^^^^^^ this code causes undefined behavior when executed
391   |
392note: enums with no inhabited variants have no valid value
393  --> $DIR/invalid_value.rs:42:1
394   |
395LL | enum TwoUninhabited {
396   | ^^^^^^^^^^^^^^^^^^^
397
398error: the type `TwoUninhabited` does not permit being left uninitialized
399  --> $DIR/invalid_value.rs:105:36
400   |
401LL |         let _val: TwoUninhabited = mem::uninitialized();
402   |                                    ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
403   |
404note: enums with no inhabited variants have no valid value
405  --> $DIR/invalid_value.rs:42:1
406   |
407LL | enum TwoUninhabited {
408   | ^^^^^^^^^^^^^^^^^^^
409
410error: the type `OneFruitNonZero` does not permit zero-initialization
411  --> $DIR/invalid_value.rs:107:37
412   |
413LL |         let _val: OneFruitNonZero = mem::zeroed();
414   |                                     ^^^^^^^^^^^^^
415   |                                     |
416   |                                     this code causes undefined behavior when executed
417   |                                     help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
418   |
419   = note: `OneFruitNonZero` must be non-null
420note: because `std::num::NonZeroU32` must be non-null (in this field of the only potentially inhabited enum variant)
421  --> $DIR/invalid_value.rs:39:12
422   |
423LL |     Banana(NonZeroU32),
424   |            ^^^^^^^^^^
425
426error: the type `OneFruitNonZero` does not permit being left uninitialized
427  --> $DIR/invalid_value.rs:108:37
428   |
429LL |         let _val: OneFruitNonZero = mem::uninitialized();
430   |                                     ^^^^^^^^^^^^^^^^^^^^
431   |                                     |
432   |                                     this code causes undefined behavior when executed
433   |                                     help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
434   |
435   = note: `OneFruitNonZero` must be non-null
436note: because `std::num::NonZeroU32` must be non-null (in this field of the only potentially inhabited enum variant)
437  --> $DIR/invalid_value.rs:39:12
438   |
439LL |     Banana(NonZeroU32),
440   |            ^^^^^^^^^^
441   = note: integers must be initialized
442
443error: the type `bool` does not permit being left uninitialized
444  --> $DIR/invalid_value.rs:112:26
445   |
446LL |         let _val: bool = mem::uninitialized();
447   |                          ^^^^^^^^^^^^^^^^^^^^
448   |                          |
449   |                          this code causes undefined behavior when executed
450   |                          help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
451   |
452   = note: booleans must be either `true` or `false`
453
454error: the type `Wrap<char>` does not permit being left uninitialized
455  --> $DIR/invalid_value.rs:115:32
456   |
457LL |         let _val: Wrap<char> = mem::uninitialized();
458   |                                ^^^^^^^^^^^^^^^^^^^^
459   |                                |
460   |                                this code causes undefined behavior when executed
461   |                                help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
462   |
463   = note: `Wrap<char>` must be initialized inside its custom valid range
464note: characters must be a valid Unicode codepoint (in this struct field)
465  --> $DIR/invalid_value.rs:17:18
466   |
467LL | struct Wrap<T> { wrapped: T }
468   |                  ^^^^^^^^^^
469
470error: the type `NonBig` does not permit being left uninitialized
471  --> $DIR/invalid_value.rs:118:28
472   |
473LL |         let _val: NonBig = mem::uninitialized();
474   |                            ^^^^^^^^^^^^^^^^^^^^
475   |                            |
476   |                            this code causes undefined behavior when executed
477   |                            help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
478   |
479   = note: `NonBig` must be initialized inside its custom valid range
480note: integers must be initialized (in this struct field)
481  --> $DIR/invalid_value.rs:23:26
482   |
483LL | pub(crate) struct NonBig(u64);
484   |                          ^^^
485
486error: the type `Fruit` does not permit being left uninitialized
487  --> $DIR/invalid_value.rs:121:27
488   |
489LL |         let _val: Fruit = mem::uninitialized();
490   |                           ^^^^^^^^^^^^^^^^^^^^
491   |                           |
492   |                           this code causes undefined behavior when executed
493   |                           help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
494   |
495note: enums with multiple inhabited variants have to be initialized to a variant
496  --> $DIR/invalid_value.rs:26:1
497   |
498LL | enum Fruit {
499   | ^^^^^^^^^^
500
501error: the type `[bool; 2]` does not permit being left uninitialized
502  --> $DIR/invalid_value.rs:124:31
503   |
504LL |         let _val: [bool; 2] = mem::uninitialized();
505   |                               ^^^^^^^^^^^^^^^^^^^^
506   |                               |
507   |                               this code causes undefined behavior when executed
508   |                               help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
509   |
510   = note: booleans must be either `true` or `false`
511
512error: the type `i32` does not permit being left uninitialized
513  --> $DIR/invalid_value.rs:127:25
514   |
515LL |         let _val: i32 = mem::uninitialized();
516   |                         ^^^^^^^^^^^^^^^^^^^^
517   |                         |
518   |                         this code causes undefined behavior when executed
519   |                         help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
520   |
521   = note: integers must be initialized
522
523error: the type `f32` does not permit being left uninitialized
524  --> $DIR/invalid_value.rs:130:25
525   |
526LL |         let _val: f32 = mem::uninitialized();
527   |                         ^^^^^^^^^^^^^^^^^^^^
528   |                         |
529   |                         this code causes undefined behavior when executed
530   |                         help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
531   |
532   = note: floats must be initialized
533
534error: the type `*const ()` does not permit being left uninitialized
535  --> $DIR/invalid_value.rs:133:31
536   |
537LL |         let _val: *const () = mem::uninitialized();
538   |                               ^^^^^^^^^^^^^^^^^^^^
539   |                               |
540   |                               this code causes undefined behavior when executed
541   |                               help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
542   |
543   = note: raw pointers must be initialized
544
545error: the type `*const [()]` does not permit being left uninitialized
546  --> $DIR/invalid_value.rs:136:33
547   |
548LL |         let _val: *const [()] = mem::uninitialized();
549   |                                 ^^^^^^^^^^^^^^^^^^^^
550   |                                 |
551   |                                 this code causes undefined behavior when executed
552   |                                 help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
553   |
554   = note: raw pointers must be initialized
555
556error: the type `WrapAroundRange` does not permit being left uninitialized
557  --> $DIR/invalid_value.rs:139:37
558   |
559LL |         let _val: WrapAroundRange = mem::uninitialized();
560   |                                     ^^^^^^^^^^^^^^^^^^^^
561   |                                     |
562   |                                     this code causes undefined behavior when executed
563   |                                     help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
564   |
565   = note: `WrapAroundRange` must be initialized inside its custom valid range
566note: integers must be initialized (in this struct field)
567  --> $DIR/invalid_value.rs:49:35
568   |
569LL | pub(crate) struct WrapAroundRange(u8);
570   |                                   ^^
571
572error: the type `Result<i32, i32>` does not permit being left uninitialized
573  --> $DIR/invalid_value.rs:144:38
574   |
575LL |         let _val: Result<i32, i32> = mem::uninitialized();
576   |                                      ^^^^^^^^^^^^^^^^^^^^
577   |                                      |
578   |                                      this code causes undefined behavior when executed
579   |                                      help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
580   |
581note: enums with multiple inhabited variants have to be initialized to a variant
582  --> $SRC_DIR/core/src/result.rs:LL:COL
583
584error: the type `&i32` does not permit zero-initialization
585  --> $DIR/invalid_value.rs:152:34
586   |
587LL |         let _val: &'static i32 = mem::transmute(0usize);
588   |                                  ^^^^^^^^^^^^^^^^^^^^^^
589   |                                  |
590   |                                  this code causes undefined behavior when executed
591   |                                  help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
592   |
593   = note: references must be non-null
594
595error: the type `&[i32]` does not permit zero-initialization
596  --> $DIR/invalid_value.rs:153:36
597   |
598LL |         let _val: &'static [i32] = mem::transmute((0usize, 0usize));
599   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
600   |                                    |
601   |                                    this code causes undefined behavior when executed
602   |                                    help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
603   |
604   = note: references must be non-null
605
606error: the type `NonZeroU32` does not permit zero-initialization
607  --> $DIR/invalid_value.rs:154:32
608   |
609LL |         let _val: NonZeroU32 = mem::transmute(0);
610   |                                ^^^^^^^^^^^^^^^^^
611   |                                |
612   |                                this code causes undefined behavior when executed
613   |                                help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
614   |
615   = note: `std::num::NonZeroU32` must be non-null
616
617error: the type `NonNull<i32>` does not permit zero-initialization
618  --> $DIR/invalid_value.rs:157:34
619   |
620LL |         let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init();
621   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
622   |                                  |
623   |                                  this code causes undefined behavior when executed
624   |                                  help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
625   |
626   = note: `std::ptr::NonNull<i32>` must be non-null
627
628error: the type `NonNull<i32>` does not permit being left uninitialized
629  --> $DIR/invalid_value.rs:158:34
630   |
631LL |         let _val: NonNull<i32> = MaybeUninit::uninit().assume_init();
632   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
633   |                                  |
634   |                                  this code causes undefined behavior when executed
635   |                                  help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
636   |
637   = note: `std::ptr::NonNull<i32>` must be non-null
638   = note: raw pointers must be initialized
639
640error: the type `bool` does not permit being left uninitialized
641  --> $DIR/invalid_value.rs:159:26
642   |
643LL |         let _val: bool = MaybeUninit::uninit().assume_init();
644   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
645   |                          |
646   |                          this code causes undefined behavior when executed
647   |                          help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
648   |
649   = note: booleans must be either `true` or `false`
650
651error: aborting due to 51 previous errors
652