Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(

Copy link
Copy Markdown
Contributor

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).

Copy link
Copy Markdown
Contributor Author

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.

Expr::bool_false(),
PropertyClass::DefaultAssertion,
"unreachable",
loc,
),
"volatile_copy_memory" => unstable_codegen!(codegen_intrinsic_copy!(Memmove)),
"volatile_copy_nonoverlapping_memory" => {
unstable_codegen!(codegen_intrinsic_copy!(Memcpy))
Expand Down
2 changes: 2 additions & 0 deletions tests/expected/intrinsics/unreachable/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FAILURE\
"unreachable code"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline?

10 changes: 10 additions & 0 deletions tests/expected/intrinsics/unreachable/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
#![feature(core_intrinsics)]

#[kani::proof]
fn main() {
unsafe {
std::intrinsics::unreachable();
}
}