Put intrinsics::unreachable on a possible path to stabilization#43750
Put intrinsics::unreachable on a possible path to stabilization#43750bors merged 3 commits intorust-lang:masterfrom
intrinsics::unreachable on a possible path to stabilization#43750Conversation
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 |
| /// 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.
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
unreachablefeature and put it into thememmodule.This is a pretty straight-forward API that can already be simulated in
stable Rust by using
transmuteto create an uninhabited enum that canbe matched.