Skip to content

Commit 048b598

Browse files
Update CBMC version to 5.79.0 (rust-lang#2301)
Co-authored-by: Zyad Hassan <[email protected]>
1 parent 12c343e commit 048b598

File tree

16 files changed

+58
-8
lines changed

16 files changed

+58
-8
lines changed

kani-compiler/src/codegen_cprover_gotoc/codegen/operand.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ impl<'tcx> GotocCtx<'tcx> {
284284
unreachable!("ZST is no longer represented as a scalar")
285285
}
286286
(Scalar::Int(_), ty::RawPtr(tm)) => {
287-
Expr::pointer_constant(s.to_u64().unwrap(), self.codegen_ty(tm.ty).to_pointer())
287+
Expr::int_constant(s.to_u64().unwrap(), Type::unsigned_int(64))
288+
.cast_to(self.codegen_ty(tm.ty).to_pointer())
288289
}
289290
// TODO: Removing this doesn't cause any regressions to fail.
290291
// We need a regression for this case.

kani-dependencies

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CBMC_VERSION="5.78.0"
1+
CBMC_VERSION="5.79.0"
22
# If you update this version number, remember to bump it in `src/setup.rs` too
33
CBMC_VIEWER_VERSION="3.8"
44
KISSAT_VERSION="3.0.0"

scripts/kani-regression.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ KANI_DIR=$SCRIPT_DIR/..
2222
export KANI_FAIL_ON_UNEXPECTED_DESCRIPTION="true"
2323

2424
# Required dependencies
25-
check-cbmc-version.py --major 5 --minor 78
25+
check-cbmc-version.py --major 5 --minor 79
2626
check-cbmc-viewer-version.py --major 3 --minor 8
2727
check_kissat_version.sh
2828

tests/cargo-kani/mir-linker/src/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
//! Dummy test to check --mir-linker runs on a cargo project.
55
use semver::{BuildMetadata, Prerelease, Version};
66

7-
// Pre-CBMC 5.72.0, this test did not require an unwinding.
8-
// TODO: figure out why it needs one now:
9-
// https://github.com/model-checking/kani/issues/1978
10-
117
#[kani::proof]
12-
#[kani::unwind(2)]
138
fn check_version() {
149
let next_major: u64 = kani::any();
1510
let next_minor: u64 = kani::any();
+11
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+
4+
[package]
5+
name = "display_trait"
6+
version = "0.1.0"
7+
edition = "2021"
8+
9+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
10+
11+
[dependencies]
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Complete - 2 successfully verified harnesses, 0 failures, 2 total.
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright Kani Contributors
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
//! This test checks the performance when adding in the Display trait.
5+
//! The test is from https://github.com/model-checking/kani/issues/1996
6+
//! With CBMC 5.79.0, all harnesses take ~3 seconds
7+
use std::fmt::Display;
8+
9+
enum Foo {
10+
A(String),
11+
B(String),
12+
}
13+
14+
impl Display for Foo {
15+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16+
let s = match self {
17+
Foo::A(s) => format!("A.{s}"),
18+
Foo::B(s) => format!("B.{s}"),
19+
};
20+
write!(f, "{s}")?;
21+
Ok(())
22+
}
23+
}
24+
25+
#[kani::proof]
26+
#[kani::unwind(6)]
27+
fn fast() {
28+
let a = Foo::A(String::from("foo"));
29+
let s = match a {
30+
Foo::A(s) => format!("A.{s}"),
31+
Foo::B(s) => format!("B.{s}"),
32+
};
33+
assert_eq!(s, "A.foo");
34+
}
35+
36+
#[kani::proof]
37+
#[kani::unwind(6)]
38+
fn slow() {
39+
let a = Foo::A(String::from("foo"));
40+
let s = a.to_string();
41+
assert_eq!(s, "A.foo");
42+
}

0 commit comments

Comments
 (0)