-
Couldn't load subscription status.
- Fork 13.9k
Constier maybe uninit #79621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constier maybe uninit #79621
Changes from all commits
8bd80e2
91772c3
1ef5dbe
f311db1
4f9fd2a
d366ed2
7bd754c
9476241
4255a5a
3282b54
345f230
d0a1e40
bdda98a
69ab0bc
1749359
0775271
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // error-pattern: any use of this value will cause an error | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I only just realized this file is in the wrong folder. It should be in an appropriate subfolder, in this case |
||
|
|
||
| #![feature(never_type)] | ||
| #![feature(const_maybe_uninit_assume_init)] | ||
|
|
||
| #[allow(invalid_value)] | ||
| fn main() { | ||
| use std::mem::MaybeUninit; | ||
|
|
||
| const _BAD: () = unsafe { | ||
| MaybeUninit::<!>::uninit().assume_init(); | ||
| }; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| error: any use of this value will cause an error | ||
| --> $SRC_DIR/core/src/mem/maybe_uninit.rs:LL:COL | ||
| | | ||
| LL | intrinsics::assert_inhabited::<T>(); | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | | ||
| | attempted to instantiate uninhabited type `!` | ||
| | inside `MaybeUninit::<!>::assume_init` at $SRC_DIR/core/src/mem/maybe_uninit.rs:LL:COL | ||
| | inside `_BAD` at $DIR/assume-type-intrinsics.rs:11:9 | ||
| | | ||
| ::: $DIR/assume-type-intrinsics.rs:10:5 | ||
| | | ||
| LL | / const _BAD: () = unsafe { | ||
| LL | | MaybeUninit::<!>::uninit().assume_init(); | ||
| LL | | }; | ||
| | |______- | ||
| | | ||
| = note: `#[deny(const_err)]` on by default | ||
|
|
||
| error: aborting due to previous error | ||
|
|
Uh oh!
There was an error while loading. Please reload this page.