rust/src/test/ui/lint/uninitialized-zeroed.stderr

437 lines
20 KiB
Plaintext
Raw Normal View History

2019-08-07 01:42:50 -05:00
error: the type `&'static T` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:29:32
|
2019-08-07 01:42:50 -05:00
LL | let _val: &'static T = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
note: lint level defined here
--> $DIR/uninitialized-zeroed.rs:7:9
|
LL | #![deny(invalid_value)]
| ^^^^^^^^^^^^^
2020-01-10 08:13:05 -06:00
= note: references must be non-null
2019-08-07 01:42:50 -05:00
error: the type `&'static T` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:30:32
2019-08-07 01:42:50 -05:00
|
LL | let _val: &'static T = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
2020-01-10 08:13:05 -06:00
= note: references must be non-null
2019-08-07 01:42:50 -05:00
error: the type `Wrap<&'static T>` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:32:38
2019-08-07 01:42:50 -05:00
|
LL | let _val: Wrap<&'static T> = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
2020-01-10 08:13:05 -06:00
note: references must be non-null (in this struct field)
--> $DIR/uninitialized-zeroed.rs:18:18
|
LL | struct Wrap<T> { wrapped: T }
| ^^^^^^^^^^
2019-08-07 01:42:50 -05:00
error: the type `Wrap<&'static T>` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:33:38
2019-08-07 01:42:50 -05:00
|
LL | let _val: Wrap<&'static T> = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
note: references must be non-null (in this struct field)
--> $DIR/uninitialized-zeroed.rs:18:18
2019-08-07 01:42:50 -05:00
|
LL | struct Wrap<T> { wrapped: T }
| ^^^^^^^^^^
2019-08-07 01:42:50 -05:00
error: the type `!` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:40:23
2019-08-07 01:42:50 -05:00
|
LL | let _val: ! = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
2020-01-10 08:13:05 -06:00
= note: the `!` type has no valid value
error: the type `!` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:41:23
|
LL | let _val: ! = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
2020-01-10 08:13:05 -06:00
= note: the `!` type has no valid value
2019-08-07 01:42:50 -05:00
error: the type `(i32, !)` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:43:30
2019-08-07 01:42:50 -05:00
|
LL | let _val: (i32, !) = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
2020-01-10 08:13:05 -06:00
= note: the `!` type has no valid value
2019-08-07 01:42:50 -05:00
error: the type `(i32, !)` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:44:30
2019-08-07 01:42:50 -05:00
|
LL | let _val: (i32, !) = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
2020-01-10 08:13:05 -06:00
= note: the `!` type has no valid value
2019-08-07 01:42:50 -05:00
error: the type `Void` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:46:26
2019-08-07 01:42:50 -05:00
|
LL | let _val: Void = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
= note: 0-variant enums have no valid value
2019-08-07 01:42:50 -05:00
error: the type `Void` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:47:26
2019-08-07 01:42:50 -05:00
|
LL | let _val: Void = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
= note: 0-variant enums have no valid value
error: the type `&'static i32` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:49:34
|
LL | let _val: &'static i32 = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
2020-01-10 08:13:05 -06:00
= note: references must be non-null
error: the type `&'static i32` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:50:34
|
LL | let _val: &'static i32 = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
2020-01-10 08:13:05 -06:00
= note: references must be non-null
2019-08-07 01:42:50 -05:00
error: the type `Ref` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:52:25
2019-08-07 01:42:50 -05:00
|
LL | let _val: Ref = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
note: references must be non-null (in this struct field)
--> $DIR/uninitialized-zeroed.rs:15:12
2019-08-07 01:42:50 -05:00
|
LL | struct Ref(&'static i32);
| ^^^^^^^^^^^^
2019-08-07 01:42:50 -05:00
error: the type `Ref` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:53:25
2019-08-07 01:42:50 -05:00
|
LL | let _val: Ref = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
2020-01-10 08:13:05 -06:00
note: references must be non-null (in this struct field)
--> $DIR/uninitialized-zeroed.rs:15:12
|
LL | struct Ref(&'static i32);
| ^^^^^^^^^^^^
error: the type `fn()` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:55:26
|
LL | let _val: fn() = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
2020-01-10 08:13:05 -06:00
= note: function pointers must be non-null
error: the type `fn()` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:56:26
|
LL | let _val: fn() = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-07 01:42:50 -05:00
|
2020-01-10 08:13:05 -06:00
= note: function pointers must be non-null
2019-08-07 01:42:50 -05:00
error: the type `Wrap<fn()>` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:58:32
2019-08-07 01:42:50 -05:00
|
LL | let _val: Wrap<fn()> = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
note: function pointers must be non-null (in this struct field)
--> $DIR/uninitialized-zeroed.rs:18:18
2019-08-07 01:42:50 -05:00
|
LL | struct Wrap<T> { wrapped: T }
| ^^^^^^^^^^
2019-08-07 01:42:50 -05:00
error: the type `Wrap<fn()>` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:59:32
2019-08-07 01:42:50 -05:00
|
LL | let _val: Wrap<fn()> = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
note: function pointers must be non-null (in this struct field)
--> $DIR/uninitialized-zeroed.rs:18:18
|
LL | struct Wrap<T> { wrapped: T }
| ^^^^^^^^^^
error: the type `WrapEnum<fn()>` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:61:36
|
LL | let _val: WrapEnum<fn()> = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
note: function pointers must be non-null (in this enum field)
--> $DIR/uninitialized-zeroed.rs:19:28
|
LL | enum WrapEnum<T> { Wrapped(T) }
| ^
error: the type `WrapEnum<fn()>` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:62:36
|
LL | let _val: WrapEnum<fn()> = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
note: function pointers must be non-null (in this enum field)
--> $DIR/uninitialized-zeroed.rs:19:28
|
LL | enum WrapEnum<T> { Wrapped(T) }
| ^
error: the type `Wrap<(RefPair, i32)>` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:64:42
|
LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
note: references must be non-null (in this struct field)
--> $DIR/uninitialized-zeroed.rs:16:16
|
LL | struct RefPair((&'static i32, i32));
| ^^^^^^^^^^^^^^^^^^^
error: the type `Wrap<(RefPair, i32)>` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:65:42
|
LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
note: references must be non-null (in this struct field)
--> $DIR/uninitialized-zeroed.rs:16:16
2019-08-07 01:42:50 -05:00
|
LL | struct RefPair((&'static i32, i32));
| ^^^^^^^^^^^^^^^^^^^
error: the type `std::ptr::NonNull<i32>` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:67:34
|
LL | let _val: NonNull<i32> = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: std::ptr::NonNull<i32> must be non-null
error: the type `std::ptr::NonNull<i32>` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:68:34
|
LL | let _val: NonNull<i32> = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: std::ptr::NonNull<i32> must be non-null
error: the type `*const dyn std::marker::Send` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:70:37
|
LL | let _val: *const dyn Send = mem::zeroed();
| ^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
= note: the vtable of a wide raw pointer must be non-null
error: the type `*const dyn std::marker::Send` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:71:37
|
LL | let _val: *const dyn Send = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
= note: the vtable of a wide raw pointer must be non-null
2019-08-17 02:39:25 -05:00
error: the type `bool` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:75:26
2019-08-17 02:39:25 -05:00
|
LL | let _val: bool = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-17 02:39:25 -05:00
|
2020-01-10 08:13:05 -06:00
= note: booleans must be either `true` or `false`
2019-08-17 02:39:25 -05:00
error: the type `Wrap<char>` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:78:32
2019-08-17 02:39:25 -05:00
|
LL | let _val: Wrap<char> = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
2019-08-17 02:39:25 -05:00
|
2020-01-10 08:13:05 -06:00
note: characters must be a valid Unicode codepoint (in this struct field)
--> $DIR/uninitialized-zeroed.rs:18:18
2019-08-17 02:39:25 -05:00
|
LL | struct Wrap<T> { wrapped: T }
| ^^^^^^^^^^
error: the type `NonBig` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:81:28
|
LL | let _val: NonBig = mem::uninitialized();
| ^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: NonBig must be initialized inside its custom valid range
error: the type `&'static i32` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:84:34
|
LL | let _val: &'static i32 = mem::transmute(0usize);
| ^^^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
= note: references must be non-null
error: the type `&'static [i32]` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:85:36
|
LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
= note: references must be non-null
error: the type `std::num::NonZeroU32` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:86:32
|
LL | let _val: NonZeroU32 = mem::transmute(0);
| ^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: std::num::NonZeroU32 must be non-null
error: the type `std::ptr::NonNull<i32>` does not permit zero-initialization
--> $DIR/uninitialized-zeroed.rs:89:34
|
LL | let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: std::ptr::NonNull<i32> must be non-null
error: the type `std::ptr::NonNull<i32>` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:90:34
|
LL | let _val: NonNull<i32> = MaybeUninit::uninit().assume_init();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: std::ptr::NonNull<i32> must be non-null
error: the type `bool` does not permit being left uninitialized
--> $DIR/uninitialized-zeroed.rs:91:26
|
LL | let _val: bool = MaybeUninit::uninit().assume_init();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
2019-11-07 03:22:50 -06:00
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
2020-01-10 08:13:05 -06:00
= note: booleans must be either `true` or `false`
error: aborting due to 35 previous errors