Skip to content

Commit 36d9c38

Browse files
authored
Undo #2194 (#2276)
1 parent fca5e92 commit 36d9c38

File tree

6 files changed

+26
-18
lines changed

6 files changed

+26
-18
lines changed

library/std/src/lib.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,7 @@ macro_rules! assert {
6161
// strategy, which is tracked in
6262
// https://github.com/model-checking/kani/issues/692
6363
if false {
64-
#[cfg(not(feature = "std"))]
6564
__kani__workaround_core_assert!(true, $($arg)+);
66-
// In a `no_std` setting where `std` is used as a feature, defining
67-
// the alias for `core::assert` doesn't work, so we need to use
68-
// `core::assert` directly (see
69-
// https://github.com/model-checking/kani/issues/2187)
70-
#[cfg(feature = "std")]
71-
core::assert!(true, $($arg)+);
7265
}
7366
}};
7467
}
@@ -172,11 +165,7 @@ macro_rules! unreachable {
172165
// handle.
173166
($fmt:expr, $($arg:tt)*) => {{
174167
if false {
175-
#[cfg(not(feature = "std"))]
176168
__kani__workaround_core_assert!(true, $fmt, $($arg)+);
177-
// See comment in `assert` definition
178-
#[cfg(feature = "std")]
179-
core::assert!(true, $fmt, $($arg)+);
180169
}
181170
kani::panic(concat!("internal error: entered unreachable code: ",
182171
stringify!($fmt, $($arg)*)))}};
@@ -208,11 +197,7 @@ macro_rules! panic {
208197
// `panic!("Error: {}", code);`
209198
($($arg:tt)+) => {{
210199
if false {
211-
#[cfg(not(feature = "std"))]
212200
__kani__workaround_core_assert!(true, $($arg)+);
213-
// See comment in `assert` definition
214-
#[cfg(feature = "std")]
215-
core::assert!(true, $($arg)+);
216201
}
217202
kani::panic(stringify!($($arg)+));
218203
}};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright Kani Contributors
2+
# SPDX-License-Identifier: Apache-2.0 OR MIT
3+
[package]
4+
name = "chrono_dep"
5+
version = "0.1.0"
6+
edition = "2021"
7+
8+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
9+
10+
[dependencies]
11+
chrono = "=0.4.19"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VERIFICATION:- SUCCESSFUL
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright Kani Contributors
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
//! This test checks that the Kani compiler handles chrono crate which was
5+
//! previously failing due to https://github.com/model-checking/kani/issues/1949
6+
7+
#[kani::proof]
8+
fn main() {
9+
assert!(1 + 1 == 2);
10+
}

tests/cargo-kani/no_std/foo.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERIFICATION:- SUCCESSFUL
1+
error: cannot find macro `__kani__workaround_core_assert` in this scope

tests/cargo-kani/no_std/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// Copyright Kani Contributors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

4-
//! This test makes sure Kani handles assert in no_std environment which was
5-
//! previous failing (see https://github.com/model-checking/kani/issues/2187)
4+
//! This test checks that Kani handles assert in no_std environment which
5+
//! currently doesn't work:
6+
//! https://github.com/model-checking/kani/issues/2187)
67
78
#![no_std]
89

0 commit comments

Comments
 (0)