11error: the type `&'static T` does not permit zero-initialization
2- --> $DIR/uninitialized-zeroed.rs:22 :32
2+ --> $DIR/uninitialized-zeroed.rs:27 :32
33 |
44LL | let _val: &'static T = mem::zeroed();
55 | ^^^^^^^^^^^^^
@@ -15,7 +15,7 @@ LL | #![deny(invalid_value)]
1515 = note: References must be non-null
1616
1717error: the type `&'static T` does not permit being left uninitialized
18- --> $DIR/uninitialized-zeroed.rs:23 :32
18+ --> $DIR/uninitialized-zeroed.rs:28 :32
1919 |
2020LL | let _val: &'static T = mem::uninitialized();
2121 | ^^^^^^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ LL | let _val: &'static T = mem::uninitialized();
2626 = note: References must be non-null
2727
2828error: the type `Wrap<&'static T>` does not permit zero-initialization
29- --> $DIR/uninitialized-zeroed.rs:25 :38
29+ --> $DIR/uninitialized-zeroed.rs:30 :38
3030 |
3131LL | let _val: Wrap<&'static T> = mem::zeroed();
3232 | ^^^^^^^^^^^^^
@@ -41,7 +41,7 @@ LL | struct Wrap<T> { wrapped: T }
4141 | ^^^^^^^^^^
4242
4343error: 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
4545 |
4646LL | let _val: Wrap<&'static T> = mem::uninitialized();
4747 | ^^^^^^^^^^^^^^^^^^^^
@@ -56,7 +56,7 @@ LL | struct Wrap<T> { wrapped: T }
5656 | ^^^^^^^^^^
5757
5858error: the type `!` does not permit zero-initialization
59- --> $DIR/uninitialized-zeroed.rs:32 :23
59+ --> $DIR/uninitialized-zeroed.rs:38 :23
6060 |
6161LL | let _val: ! = mem::zeroed();
6262 | ^^^^^^^^^^^^^
@@ -67,7 +67,7 @@ LL | let _val: ! = mem::zeroed();
6767 = note: The never type (`!`) has no valid value
6868
6969error: the type `!` does not permit being left uninitialized
70- --> $DIR/uninitialized-zeroed.rs:33 :23
70+ --> $DIR/uninitialized-zeroed.rs:39 :23
7171 |
7272LL | let _val: ! = mem::uninitialized();
7373 | ^^^^^^^^^^^^^^^^^^^^
@@ -78,7 +78,7 @@ LL | let _val: ! = mem::uninitialized();
7878 = note: The never type (`!`) has no valid value
7979
8080error: the type `(i32, !)` does not permit zero-initialization
81- --> $DIR/uninitialized-zeroed.rs:35 :30
81+ --> $DIR/uninitialized-zeroed.rs:41 :30
8282 |
8383LL | let _val: (i32, !) = mem::zeroed();
8484 | ^^^^^^^^^^^^^
@@ -89,7 +89,7 @@ LL | let _val: (i32, !) = mem::zeroed();
8989 = note: The never type (`!`) has no valid value
9090
9191error: the type `(i32, !)` does not permit being left uninitialized
92- --> $DIR/uninitialized-zeroed.rs:36 :30
92+ --> $DIR/uninitialized-zeroed.rs:42 :30
9393 |
9494LL | let _val: (i32, !) = mem::uninitialized();
9595 | ^^^^^^^^^^^^^^^^^^^^
@@ -100,7 +100,7 @@ LL | let _val: (i32, !) = mem::uninitialized();
100100 = note: The never type (`!`) has no valid value
101101
102102error: the type `Void` does not permit zero-initialization
103- --> $DIR/uninitialized-zeroed.rs:38 :26
103+ --> $DIR/uninitialized-zeroed.rs:44 :26
104104 |
105105LL | let _val: Void = mem::zeroed();
106106 | ^^^^^^^^^^^^^
@@ -111,7 +111,7 @@ LL | let _val: Void = mem::zeroed();
111111 = note: 0-variant enums have no valid value
112112
113113error: the type `Void` does not permit being left uninitialized
114- --> $DIR/uninitialized-zeroed.rs:39 :26
114+ --> $DIR/uninitialized-zeroed.rs:45 :26
115115 |
116116LL | let _val: Void = mem::uninitialized();
117117 | ^^^^^^^^^^^^^^^^^^^^
@@ -122,7 +122,7 @@ LL | let _val: Void = mem::uninitialized();
122122 = note: 0-variant enums have no valid value
123123
124124error: the type `&'static i32` does not permit zero-initialization
125- --> $DIR/uninitialized-zeroed.rs:41 :34
125+ --> $DIR/uninitialized-zeroed.rs:47 :34
126126 |
127127LL | let _val: &'static i32 = mem::zeroed();
128128 | ^^^^^^^^^^^^^
@@ -133,7 +133,7 @@ LL | let _val: &'static i32 = mem::zeroed();
133133 = note: References must be non-null
134134
135135error: the type `&'static i32` does not permit being left uninitialized
136- --> $DIR/uninitialized-zeroed.rs:42 :34
136+ --> $DIR/uninitialized-zeroed.rs:48 :34
137137 |
138138LL | let _val: &'static i32 = mem::uninitialized();
139139 | ^^^^^^^^^^^^^^^^^^^^
@@ -144,7 +144,7 @@ LL | let _val: &'static i32 = mem::uninitialized();
144144 = note: References must be non-null
145145
146146error: the type `Ref` does not permit zero-initialization
147- --> $DIR/uninitialized-zeroed.rs:44 :25
147+ --> $DIR/uninitialized-zeroed.rs:50 :25
148148 |
149149LL | let _val: Ref = mem::zeroed();
150150 | ^^^^^^^^^^^^^
@@ -159,7 +159,7 @@ LL | struct Ref(&'static i32);
159159 | ^^^^^^^^^^^^
160160
161161error: the type `Ref` does not permit being left uninitialized
162- --> $DIR/uninitialized-zeroed.rs:45 :25
162+ --> $DIR/uninitialized-zeroed.rs:51 :25
163163 |
164164LL | let _val: Ref = mem::uninitialized();
165165 | ^^^^^^^^^^^^^^^^^^^^
@@ -174,7 +174,7 @@ LL | struct Ref(&'static i32);
174174 | ^^^^^^^^^^^^
175175
176176error: the type `fn()` does not permit zero-initialization
177- --> $DIR/uninitialized-zeroed.rs:47 :26
177+ --> $DIR/uninitialized-zeroed.rs:53 :26
178178 |
179179LL | let _val: fn() = mem::zeroed();
180180 | ^^^^^^^^^^^^^
@@ -185,7 +185,7 @@ LL | let _val: fn() = mem::zeroed();
185185 = note: Function pointers must be non-null
186186
187187error: the type `fn()` does not permit being left uninitialized
188- --> $DIR/uninitialized-zeroed.rs:48 :26
188+ --> $DIR/uninitialized-zeroed.rs:54 :26
189189 |
190190LL | let _val: fn() = mem::uninitialized();
191191 | ^^^^^^^^^^^^^^^^^^^^
@@ -196,7 +196,7 @@ LL | let _val: fn() = mem::uninitialized();
196196 = note: Function pointers must be non-null
197197
198198error: the type `Wrap<fn()>` does not permit zero-initialization
199- --> $DIR/uninitialized-zeroed.rs:50 :32
199+ --> $DIR/uninitialized-zeroed.rs:56 :32
200200 |
201201LL | let _val: Wrap<fn()> = mem::zeroed();
202202 | ^^^^^^^^^^^^^
@@ -211,7 +211,7 @@ LL | struct Wrap<T> { wrapped: T }
211211 | ^^^^^^^^^^
212212
213213error: the type `Wrap<fn()>` does not permit being left uninitialized
214- --> $DIR/uninitialized-zeroed.rs:51 :32
214+ --> $DIR/uninitialized-zeroed.rs:57 :32
215215 |
216216LL | let _val: Wrap<fn()> = mem::uninitialized();
217217 | ^^^^^^^^^^^^^^^^^^^^
@@ -226,7 +226,7 @@ LL | struct Wrap<T> { wrapped: T }
226226 | ^^^^^^^^^^
227227
228228error: the type `WrapEnum<fn()>` does not permit zero-initialization
229- --> $DIR/uninitialized-zeroed.rs:53 :36
229+ --> $DIR/uninitialized-zeroed.rs:59 :36
230230 |
231231LL | let _val: WrapEnum<fn()> = mem::zeroed();
232232 | ^^^^^^^^^^^^^
@@ -241,7 +241,7 @@ LL | enum WrapEnum<T> { Wrapped(T) }
241241 | ^
242242
243243error: the type `WrapEnum<fn()>` does not permit being left uninitialized
244- --> $DIR/uninitialized-zeroed.rs:54 :36
244+ --> $DIR/uninitialized-zeroed.rs:60 :36
245245 |
246246LL | let _val: WrapEnum<fn()> = mem::uninitialized();
247247 | ^^^^^^^^^^^^^^^^^^^^
@@ -256,7 +256,7 @@ LL | enum WrapEnum<T> { Wrapped(T) }
256256 | ^
257257
258258error: the type `Wrap<(RefPair, i32)>` does not permit zero-initialization
259- --> $DIR/uninitialized-zeroed.rs:56 :42
259+ --> $DIR/uninitialized-zeroed.rs:62 :42
260260 |
261261LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed();
262262 | ^^^^^^^^^^^^^
@@ -271,7 +271,7 @@ LL | struct RefPair((&'static i32, i32));
271271 | ^^^^^^^^^^^^^^^^^^^
272272
273273error: 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
275275 |
276276LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
277277 | ^^^^^^^^^^^^^^^^^^^^
@@ -285,8 +285,38 @@ note: References must be non-null (in this struct field)
285285LL | struct RefPair((&'static i32, i32));
286286 | ^^^^^^^^^^^^^^^^^^^
287287
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+
288318error: the type `bool` does not permit being left uninitialized
289- --> $DIR/uninitialized-zeroed.rs:59 :26
319+ --> $DIR/uninitialized-zeroed.rs:70 :26
290320 |
291321LL | let _val: bool = mem::uninitialized();
292322 | ^^^^^^^^^^^^^^^^^^^^
@@ -297,7 +327,7 @@ LL | let _val: bool = mem::uninitialized();
297327 = note: Booleans must be `true` or `false`
298328
299329error: the type `Wrap<char>` does not permit being left uninitialized
300- --> $DIR/uninitialized-zeroed.rs:60 :32
330+ --> $DIR/uninitialized-zeroed.rs:73 :32
301331 |
302332LL | let _val: Wrap<char> = mem::uninitialized();
303333 | ^^^^^^^^^^^^^^^^^^^^
@@ -311,5 +341,16 @@ note: Characters must be a valid unicode codepoint (in this struct field)
311341LL | struct Wrap<T> { wrapped: T }
312342 | ^^^^^^^^^^
313343
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
315356
0 commit comments