Remove implementation for the unreachable intrinsic#1100
Merged
adpaco-aws merged 3 commits intomodel-checking:mainfrom Apr 25, 2022
Merged
Remove implementation for the unreachable intrinsic#1100adpaco-aws merged 3 commits intomodel-checking:mainfrom
unreachable intrinsic#1100adpaco-aws merged 3 commits intomodel-checking:mainfrom
Conversation
danielsn
approved these changes
Apr 25, 2022
| @@ -0,0 +1,2 @@ | |||
| FAILURE\ | |||
| "unreachable code" No newline at end of file | |||
zhassan-aws
reviewed
Apr 25, 2022
| } | ||
| "unchecked_sub" => codegen_op_with_overflow_check!(sub_overflow), | ||
| "unlikely" => self.codegen_expr_to_place(p, fargs.remove(0)), | ||
| "unreachable" => self.codegen_assert( |
Contributor
There was a problem hiding this comment.
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).
Contributor
Author
There was a problem hiding this comment.
Ok, I will add this in a follow-up PR.
This was referenced Apr 27, 2022
Closed
tedinski
pushed a commit
that referenced
this pull request
Apr 27, 2022
* Remove `unreachable` from intrinsics * Add test for uses of `unreachable`
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes:
The implementation we had for the
unreachableintrinsic 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.