-
Notifications
You must be signed in to change notification settings - Fork 97
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
Remove implementation for the unreachable
intrinsic
#1100
Conversation
@@ -0,0 +1,2 @@ | |||
FAILURE\ | |||
"unreachable code" |
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.
newline?
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.
Nice catch
@@ -607,12 +607,6 @@ impl<'tcx> GotocCtx<'tcx> { | |||
} | |||
"unchecked_sub" => codegen_op_with_overflow_check!(sub_overflow), | |||
"unlikely" => self.codegen_expr_to_place(p, fargs.remove(0)), | |||
"unreachable" => self.codegen_assert( |
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.
Since unreachable
should be unreachable, I suggest making this more explicit:
"unreachable" => unreachable!("Expecting unreachable intrinsic to be handled using Terminator::Unreachable")
because just removing it gives the impression that it is not yet implemented (gets included in the _
bucket at the end of match statement).
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.
Ok, I will add this in a follow-up PR.
* Remove `unreachable` from intrinsics * Add test for uses of `unreachable`
Description of changes:
The implementation we had for the
unreachable
intrinsic is unreachable itself. The code being executed is actually theTerminatorKind::Unreachable
, which generates an assert-false statement with the message "unreachable code".Adding a test to ensure this keeps happening.
Resolved issues:
Part of #727
Call-outs:
Testing:
How is this change tested? Adds one test.
Is this a refactor change? No.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.