Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
3 changes: 2 additions & 1 deletion kani-compiler/src/codegen_cprover_gotoc/codegen/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,14 @@ impl GotocCtx<'_> {
counter_data: &str,
span: SpanStable,
source_region: SourceRegion,
file_name: &str,
) -> Stmt {
let loc = self.codegen_caller_span_stable(span);
// Should use Stmt::cover, but currently this doesn't work with CBMC
// unless it is run with '--cover cover' (see
// https://github.com/diffblue/cbmc/issues/6613). So for now use
// `assert(false)`.
let msg = format!("{counter_data} - {source_region:?}");
let msg = format!("{counter_data} - {file_name}:{source_region:?}");
self.codegen_assert(Expr::bool_false(), PropertyClass::CodeCoverage, &msg, loc)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ impl GotocCtx<'_> {
let maybe_source_region =
region_from_coverage_opaque(self.tcx, &coverage_opaque, instance);
if let Some(source_region) = maybe_source_region {
let file_name = format!("{:?}", stmt.span.get_filename());
let coverage_stmt =
self.codegen_coverage(&counter_data, stmt.span, source_region);
self.codegen_coverage(&counter_data, stmt.span, source_region, &file_name);
// TODO: Avoid single-statement blocks when conversion of
// standalone statements to the irep format is fixed.
// More details in <https://github.com/model-checking/kani/issues/3012>
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT

[toolchain]
channel = "nightly-2024-11-09"
channel = "nightly-2024-11-11"
components = ["llvm-tools", "rustc-dev", "rust-src", "rustfmt"]
2 changes: 1 addition & 1 deletion tests/coverage/assert/expected
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
10| 1| if x < 3 ```{'''\
11| 0| ``` // unreachable'''\
12| 0| ``` assert!(x == 2);'''\
13| 0| ``` }'''``` '''\
13| 0| ``` ```}''''''\
14| 1| } else {\
15| 1| // passes\
16| 1| assert!(x <= 5);\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
10| 1| let x: u32 = kani::any_where(|val| *val == 5);\
11| 1| if x > 3 {\
12| 1| assert!(x > 4);\
13| 1| }``` '''\
13| 1| ```}'''\
14| | }\