1 error: the type `&'static T` does not permit zero-initialization
2 --> $DIR/uninitialized-zeroed.rs:27:32
4 LL | let _val: &'static T = mem::zeroed();
7 | this code causes undefined behavior when executed
8 | help: use `MaybeUninit<T>` instead
10 note: lint level defined here
11 --> $DIR/uninitialized-zeroed.rs:7:9
13 LL | #![deny(invalid_value)]
15 = note: References must be non-null
17 error: the type `&'static T` does not permit being left uninitialized
18 --> $DIR/uninitialized-zeroed.rs:28:32
20 LL | let _val: &'static T = mem::uninitialized();
21 | ^^^^^^^^^^^^^^^^^^^^
23 | this code causes undefined behavior when executed
24 | help: use `MaybeUninit<T>` instead
26 = note: References must be non-null
28 error: the type `Wrap<&'static T>` does not permit zero-initialization
29 --> $DIR/uninitialized-zeroed.rs:30:38
31 LL | let _val: Wrap<&'static T> = mem::zeroed();
34 | this code causes undefined behavior when executed
35 | help: use `MaybeUninit<T>` instead
37 note: References must be non-null (in this struct field)
38 --> $DIR/uninitialized-zeroed.rs:16:18
40 LL | struct Wrap<T> { wrapped: T }
43 error: the type `Wrap<&'static T>` does not permit being left uninitialized
44 --> $DIR/uninitialized-zeroed.rs:31:38
46 LL | let _val: Wrap<&'static T> = mem::uninitialized();
47 | ^^^^^^^^^^^^^^^^^^^^
49 | this code causes undefined behavior when executed
50 | help: use `MaybeUninit<T>` instead
52 note: References must be non-null (in this struct field)
53 --> $DIR/uninitialized-zeroed.rs:16:18
55 LL | struct Wrap<T> { wrapped: T }
58 error: the type `!` does not permit zero-initialization
59 --> $DIR/uninitialized-zeroed.rs:38:23
61 LL | let _val: ! = mem::zeroed();
64 | this code causes undefined behavior when executed
65 | help: use `MaybeUninit<T>` instead
67 = note: The never type (`!`) has no valid value
69 error: the type `!` does not permit being left uninitialized
70 --> $DIR/uninitialized-zeroed.rs:39:23
72 LL | let _val: ! = mem::uninitialized();
73 | ^^^^^^^^^^^^^^^^^^^^
75 | this code causes undefined behavior when executed
76 | help: use `MaybeUninit<T>` instead
78 = note: The never type (`!`) has no valid value
80 error: the type `(i32, !)` does not permit zero-initialization
81 --> $DIR/uninitialized-zeroed.rs:41:30
83 LL | let _val: (i32, !) = mem::zeroed();
86 | this code causes undefined behavior when executed
87 | help: use `MaybeUninit<T>` instead
89 = note: The never type (`!`) has no valid value
91 error: the type `(i32, !)` does not permit being left uninitialized
92 --> $DIR/uninitialized-zeroed.rs:42:30
94 LL | let _val: (i32, !) = mem::uninitialized();
95 | ^^^^^^^^^^^^^^^^^^^^
97 | this code causes undefined behavior when executed
98 | help: use `MaybeUninit<T>` instead
100 = note: The never type (`!`) has no valid value
102 error: the type `Void` does not permit zero-initialization
103 --> $DIR/uninitialized-zeroed.rs:44:26
105 LL | let _val: Void = mem::zeroed();
108 | this code causes undefined behavior when executed
109 | help: use `MaybeUninit<T>` instead
111 = note: 0-variant enums have no valid value
113 error: the type `Void` does not permit being left uninitialized
114 --> $DIR/uninitialized-zeroed.rs:45:26
116 LL | let _val: Void = mem::uninitialized();
117 | ^^^^^^^^^^^^^^^^^^^^
119 | this code causes undefined behavior when executed
120 | help: use `MaybeUninit<T>` instead
122 = note: 0-variant enums have no valid value
124 error: the type `&'static i32` does not permit zero-initialization
125 --> $DIR/uninitialized-zeroed.rs:47:34
127 LL | let _val: &'static i32 = mem::zeroed();
130 | this code causes undefined behavior when executed
131 | help: use `MaybeUninit<T>` instead
133 = note: References must be non-null
135 error: the type `&'static i32` does not permit being left uninitialized
136 --> $DIR/uninitialized-zeroed.rs:48:34
138 LL | let _val: &'static i32 = mem::uninitialized();
139 | ^^^^^^^^^^^^^^^^^^^^
141 | this code causes undefined behavior when executed
142 | help: use `MaybeUninit<T>` instead
144 = note: References must be non-null
146 error: the type `Ref` does not permit zero-initialization
147 --> $DIR/uninitialized-zeroed.rs:50:25
149 LL | let _val: Ref = mem::zeroed();
152 | this code causes undefined behavior when executed
153 | help: use `MaybeUninit<T>` instead
155 note: References must be non-null (in this struct field)
156 --> $DIR/uninitialized-zeroed.rs:13:12
158 LL | struct Ref(&'static i32);
161 error: the type `Ref` does not permit being left uninitialized
162 --> $DIR/uninitialized-zeroed.rs:51:25
164 LL | let _val: Ref = mem::uninitialized();
165 | ^^^^^^^^^^^^^^^^^^^^
167 | this code causes undefined behavior when executed
168 | help: use `MaybeUninit<T>` instead
170 note: References must be non-null (in this struct field)
171 --> $DIR/uninitialized-zeroed.rs:13:12
173 LL | struct Ref(&'static i32);
176 error: the type `fn()` does not permit zero-initialization
177 --> $DIR/uninitialized-zeroed.rs:53:26
179 LL | let _val: fn() = mem::zeroed();
182 | this code causes undefined behavior when executed
183 | help: use `MaybeUninit<T>` instead
185 = note: Function pointers must be non-null
187 error: the type `fn()` does not permit being left uninitialized
188 --> $DIR/uninitialized-zeroed.rs:54:26
190 LL | let _val: fn() = mem::uninitialized();
191 | ^^^^^^^^^^^^^^^^^^^^
193 | this code causes undefined behavior when executed
194 | help: use `MaybeUninit<T>` instead
196 = note: Function pointers must be non-null
198 error: the type `Wrap<fn()>` does not permit zero-initialization
199 --> $DIR/uninitialized-zeroed.rs:56:32
201 LL | let _val: Wrap<fn()> = mem::zeroed();
204 | this code causes undefined behavior when executed
205 | help: use `MaybeUninit<T>` instead
207 note: Function pointers must be non-null (in this struct field)
208 --> $DIR/uninitialized-zeroed.rs:16:18
210 LL | struct Wrap<T> { wrapped: T }
213 error: the type `Wrap<fn()>` does not permit being left uninitialized
214 --> $DIR/uninitialized-zeroed.rs:57:32
216 LL | let _val: Wrap<fn()> = mem::uninitialized();
217 | ^^^^^^^^^^^^^^^^^^^^
219 | this code causes undefined behavior when executed
220 | help: use `MaybeUninit<T>` instead
222 note: Function pointers must be non-null (in this struct field)
223 --> $DIR/uninitialized-zeroed.rs:16:18
225 LL | struct Wrap<T> { wrapped: T }
228 error: the type `WrapEnum<fn()>` does not permit zero-initialization
229 --> $DIR/uninitialized-zeroed.rs:59:36
231 LL | let _val: WrapEnum<fn()> = mem::zeroed();
234 | this code causes undefined behavior when executed
235 | help: use `MaybeUninit<T>` instead
237 note: Function pointers must be non-null (in this enum field)
238 --> $DIR/uninitialized-zeroed.rs:17:28
240 LL | enum WrapEnum<T> { Wrapped(T) }
243 error: the type `WrapEnum<fn()>` does not permit being left uninitialized
244 --> $DIR/uninitialized-zeroed.rs:60:36
246 LL | let _val: WrapEnum<fn()> = mem::uninitialized();
247 | ^^^^^^^^^^^^^^^^^^^^
249 | this code causes undefined behavior when executed
250 | help: use `MaybeUninit<T>` instead
252 note: Function pointers must be non-null (in this enum field)
253 --> $DIR/uninitialized-zeroed.rs:17:28
255 LL | enum WrapEnum<T> { Wrapped(T) }
258 error: the type `Wrap<(RefPair, i32)>` does not permit zero-initialization
259 --> $DIR/uninitialized-zeroed.rs:62:42
261 LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed();
264 | this code causes undefined behavior when executed
265 | help: use `MaybeUninit<T>` instead
267 note: References must be non-null (in this struct field)
268 --> $DIR/uninitialized-zeroed.rs:14:16
270 LL | struct RefPair((&'static i32, i32));
271 | ^^^^^^^^^^^^^^^^^^^
273 error: the type `Wrap<(RefPair, i32)>` does not permit being left uninitialized
274 --> $DIR/uninitialized-zeroed.rs:63:42
276 LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
277 | ^^^^^^^^^^^^^^^^^^^^
279 | this code causes undefined behavior when executed
280 | help: use `MaybeUninit<T>` instead
282 note: References must be non-null (in this struct field)
283 --> $DIR/uninitialized-zeroed.rs:14:16
285 LL | struct RefPair((&'static i32, i32));
286 | ^^^^^^^^^^^^^^^^^^^
288 error: the type `std::vec::Vec<i32>` does not permit zero-initialization
289 --> $DIR/uninitialized-zeroed.rs:65:30
291 LL | let _val: Vec<i32> = mem::zeroed();
294 | this code causes undefined behavior when executed
295 | help: use `MaybeUninit<T>` instead
297 note: std::ptr::Unique<i32> must be non-null (in this struct field)
298 --> $SRC_DIR/liballoc/raw_vec.rs:LL:COL
303 error: the type `std::vec::Vec<i32>` does not permit being left uninitialized
304 --> $DIR/uninitialized-zeroed.rs:66:30
306 LL | let _val: Vec<i32> = mem::uninitialized();
307 | ^^^^^^^^^^^^^^^^^^^^
309 | this code causes undefined behavior when executed
310 | help: use `MaybeUninit<T>` instead
312 note: std::ptr::Unique<i32> must be non-null (in this struct field)
313 --> $SRC_DIR/liballoc/raw_vec.rs:LL:COL
318 error: the type `bool` does not permit being left uninitialized
319 --> $DIR/uninitialized-zeroed.rs:70:26
321 LL | let _val: bool = mem::uninitialized();
322 | ^^^^^^^^^^^^^^^^^^^^
324 | this code causes undefined behavior when executed
325 | help: use `MaybeUninit<T>` instead
327 = note: Booleans must be `true` or `false`
329 error: the type `Wrap<char>` does not permit being left uninitialized
330 --> $DIR/uninitialized-zeroed.rs:73:32
332 LL | let _val: Wrap<char> = mem::uninitialized();
333 | ^^^^^^^^^^^^^^^^^^^^
335 | this code causes undefined behavior when executed
336 | help: use `MaybeUninit<T>` instead
338 note: Characters must be a valid unicode codepoint (in this struct field)
339 --> $DIR/uninitialized-zeroed.rs:16:18
341 LL | struct Wrap<T> { wrapped: T }
344 error: the type `NonBig` does not permit being left uninitialized
345 --> $DIR/uninitialized-zeroed.rs:76:28
347 LL | let _val: NonBig = mem::uninitialized();
348 | ^^^^^^^^^^^^^^^^^^^^
350 | this code causes undefined behavior when executed
351 | help: use `MaybeUninit<T>` instead
353 = note: NonBig must be initialized inside its custom valid range
355 error: aborting due to 27 previous errors