You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#![feature(intrinsics)]mod intrinsics {extern"rust-intrinsic"{fnunreachable() -> !;}}#[inline]#[stable(feature = "unreachable", since = "1.27.0")]// #[rustc_const_unstable(feature = "const_unreachable_unchecked", issue = "53188")]pubconstunsafefnunreachable_unchecked() -> ! {// SAFETY: the safety contract for `intrinsics::unreachable` must// be upheld by the caller.unsafe{ intrinsics::unreachable()}}
I expected to see this happen: no errors. This is taken from core 1.49.
Instead, this happened:
test.rs:15:14: error: only functions marked as ‘const’ are allowed to be called from constant contexts[E0015]15 | unsafe{ intrinsics::unreachable()}
| ^~~~~~~~~~
The way this is handled is in collaboration with #2999, as per the doc:
Furthermore this attribute is needed to mark an intrinsic as const fn, because there's no way to add const to functions in extern blocks for now.
I tried this code:
I expected to see this happen: no errors. This is taken from
core
1.49.Instead, this happened:
The way this is handled is in collaboration with #2999, as per the doc:
https://rustc-dev-guide.rust-lang.org/stability.html#rustc_const_unstable
(and similarly for
#[rustc_const_stable]
)The text was updated successfully, but these errors were encountered: