Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions library/core/src/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,16 +1692,16 @@ pub macro offset_of($Container:ty, $($fields:expr)+ $(,)?) {
/// # Examples
///
/// ```
/// #![feature(mem_conjure_zst)]
/// use std::mem::conjure_zst;
///
/// assert_eq!(unsafe { conjure_zst::<()>() }, ());
/// assert_eq!(unsafe { conjure_zst::<[i32; 0]>() }, []);
/// ```
///
/// [inhabited]: https://doc.rust-lang.org/reference/glossary.html#inhabited
#[unstable(feature = "mem_conjure_zst", issue = "95383")]
#[rustc_const_unstable(feature = "mem_conjure_zst", issue = "95383")]
#[stable(feature = "mem_conjure_zst", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "mem_conjure_zst", since = "CURRENT_RUSTC_VERSION")]
#[rustc_allow_const_fn_unstable(const_type_name)] // type_name() called only at run time
pub const unsafe fn conjure_zst<T>() -> T {
const_assert!(
T::IS_ZST,
Expand Down
2 changes: 1 addition & 1 deletion library/proc_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#![feature(restricted_std)]
#![feature(rustc_attrs)]
#![feature(extend_one)]
#![feature(mem_conjure_zst)]
#![feature(f16)]
#![cfg_attr(bootstrap, feature(mem_conjure_zst))]
#![recursion_limit = "256"]
#![allow(internal_features)]
#![deny(ffi_unwind_calls)]
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/consts/std/conjure_zst.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(mem_conjure_zst)]

use std::{convert::Infallible, mem};

const INVALID: Infallible = unsafe { mem::conjure_zst() };
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/std/conjure_zst.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0080]: evaluation panicked: aborted execution: attempted to instantiate uninhabited type `!`
--> $DIR/conjure_zst.rs:5:38
--> $DIR/conjure_zst.rs:3:38
|
LL | const INVALID: Infallible = unsafe { mem::conjure_zst() };
| ^^^^^^^^^^^^^^^^^^ evaluation of `INVALID` failed inside this call
Expand Down
Loading