-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Put intrinsics::unreachable
on a possible path to stabilization
#43750
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
Conversation
Mark it with the `unreachable` feature and put it into the `mem` module. This is a pretty straight-forward API that can already be simulated in stable Rust by using `transmute` to create an uninhabited enum that can be matched.
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
I think this is pretty basic functionality for a systems programming language and was a bit surprised to see that it still wasn't stable or on the path to stabilization. |
Seems reasonable to me! cc @rust-lang/libs. Can you make a tracking issue for it and update the stability annotation? |
SGTM |
Tracking issue: #43751. |
I don't think we need to do a full fcp merge or anything like that - this is still unstable, and it's a pretty straightforward thing to expose IMO. @bors r+ |
📌 Commit 5704b07 has been approved by |
@sfackler Don't you need to re-r+ this? |
dunno @bors r+ |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 5704b07 has been approved by |
src/libcore/mem.rs
Outdated
/// macro, which panics when it is executed, it is *undefined behavior* to | ||
/// reach code marked with this function. | ||
#[unstable(feature = "unreachable", issue = "43751")] | ||
pub unsafe fn unreachable() -> ! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be #[inline]
in order to allow optimizations to optimize it outside libcore?
@alexcrichton Fixed. |
@bors: r=sfackler |
📌 Commit faadd35 has been approved by |
Put `intrinsics::unreachable` on a possible path to stabilization Mark it with the `unreachable` feature and put it into the `mem` module. This is a pretty straight-forward API that can already be simulated in stable Rust by using `transmute` to create an uninhabited enum that can be matched.
☀️ Test successful - status-appveyor, status-travis |
Mark it with the
unreachable
feature and put it into themem
module.This is a pretty straight-forward API that can already be simulated in
stable Rust by using
transmute
to create an uninhabited enum that canbe matched.