forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "fixme" testcase for rust-lang#1208 (rust-lang#1210)
* Add "fixme" testcase for rust-lang#1208 I also added an override for the `unreachable!()` macro to print nicer error message. * Document override + test
- Loading branch information
Showing
4 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Failed Checks: attempt to subtract with overflow | ||
Failed Checks: internal error: entered unreachable code: "Previous statement should fail" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
//! Checks that code after an overflow check failure should be unreachable. | ||
//! Related issue: https://github.com/model-checking/kani/issues/1208 | ||
#[kani::proof] | ||
fn check_arith_overflow() { | ||
let a = [0; 5]; | ||
let ptr0: *const i32 = &a[0]; | ||
let ptr1: *const i32 = &a[1]; | ||
let _: usize = ptr0 as usize - ptr1 as usize; | ||
unreachable!("Previous statement should fail"); | ||
} |