Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into enable-post_condition
Browse files Browse the repository at this point in the history
  • Loading branch information
tautschnig committed Jan 22, 2025
2 parents f5f369b + f8a1488 commit fd126f6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ impl<'tcx> PointsToAnalysis<'_, 'tcx> {
// The same story from BinOp applies here, too. Need to track those things.
self.successors_for_operand(state, operand)
}
Rvalue::NullaryOp(..) | Rvalue::Discriminant(..) => {
Rvalue::NullaryOp(..) | Rvalue::Discriminant(..) | Rvalue::Len(_) => {
// All of those should yield a constant.
HashSet::new()
}
Expand Down
17 changes: 7 additions & 10 deletions kani-compiler/src/kani_middle/reachability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,13 @@ where
.iter()
.filter_map(|item| {
// Only collect monomorphic items.
// TODO: Remove the def_kind check once https://github.com/rust-lang/rust/pull/119135 has been released.
let def_id = rustc_internal::internal(tcx, item.def_id());
(matches!(tcx.def_kind(def_id), rustc_hir::def::DefKind::Ctor(..))
|| matches!(item.kind(), ItemKind::Fn))
.then(|| {
Instance::try_from(*item)
.ok()
.and_then(|instance| predicate(tcx, instance).then_some(instance))
})
.flatten()
matches!(item.kind(), ItemKind::Fn)
.then(|| {
Instance::try_from(*item)
.ok()
.and_then(|instance| predicate(tcx, instance).then_some(instance))
})
.flatten()
})
.collect::<Vec<_>>()
}
Expand Down
1 change: 0 additions & 1 deletion kani-compiler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#![feature(f128)]
#![feature(f16)]
#![feature(non_exhaustive_omitted_patterns_lint)]
#![feature(float_next_up_down)]
#![feature(try_blocks)]
extern crate rustc_abi;
extern crate rustc_ast;
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-2025-01-16"
channel = "nightly-2025-01-22"
components = ["llvm-tools", "rustc-dev", "rust-src", "rustfmt"]
7 changes: 5 additions & 2 deletions tests/expected/function-contract/valid_ptr.expected
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ Failed Checks: |result| kani::mem::can_dereference(result.0)
VERIFICATION:- FAILED

Checking harness pre_condition::harness_invalid_ptr...
VERIFICATION:- SUCCESSFUL (encountered one or more panics as expected)
Failed Checks: assertion failed: unsafe { read_ptr(ptr) } == -20
Failed Checks: Kani does not support reasoning about pointer to unallocated memory
Failed Checks: dereference failure: pointer outside object bounds
VERIFICATION:- FAILED

Checking harness pre_condition::harness_stack_ptr...
VERIFICATION:- SUCCESSFUL

Checking harness pre_condition::harness_head_ptr...
VERIFICATION:- SUCCESSFUL

Complete - 3 successfully verified harnesses, 1 failures, 4 total
Complete - 2 successfully verified harnesses, 2 failures, 4 total
1 change: 0 additions & 1 deletion tests/expected/function-contract/valid_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ mod pre_condition {
}

#[kani::proof_for_contract(read_ptr)]
#[kani::should_panic]
fn harness_invalid_ptr() {
let ptr = std::ptr::NonNull::<i32>::dangling().as_ptr();
assert_eq!(unsafe { read_ptr(ptr) }, -20);
Expand Down

0 comments on commit fd126f6

Please sign in to comment.