Skip to content

Commit a6f00a0

Browse files
committed
Fix the merge
1 parent 623420d commit a6f00a0

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

kani-compiler/src/kani_middle/analysis.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ impl<'tcx> From<&Statement<'tcx>> for Key {
138138
| StatementKind::ConstEvalCounter
139139
| StatementKind::FakeRead(_)
140140
| StatementKind::Nop
141+
| StatementKind::PlaceMention(_)
141142
| StatementKind::Retag(_, _)
142143
| StatementKind::StorageLive(_)
143144
| StatementKind::StorageDead(_) => Key("Ignored"),
@@ -148,11 +149,9 @@ impl<'tcx> From<&Statement<'tcx>> for Key {
148149
impl<'tcx> From<&Terminator<'tcx>> for Key {
149150
fn from(value: &Terminator<'tcx>) -> Self {
150151
match value.kind {
151-
TerminatorKind::Abort => Key("Abort"),
152152
TerminatorKind::Assert { .. } => Key("Assert"),
153153
TerminatorKind::Call { .. } => Key("Call"),
154154
TerminatorKind::Drop { .. } => Key("Drop"),
155-
TerminatorKind::DropAndReplace { .. } => Key("DropAndReplace"),
156155
TerminatorKind::GeneratorDrop => Key("GeneratorDrop"),
157156
TerminatorKind::Goto { .. } => Key("Goto"),
158157
TerminatorKind::FalseEdge { .. } => Key("FalseEdge"),
@@ -161,6 +160,7 @@ impl<'tcx> From<&Terminator<'tcx>> for Key {
161160
TerminatorKind::Resume => Key("Resume"),
162161
TerminatorKind::Return => Key("Return"),
163162
TerminatorKind::SwitchInt { .. } => Key("SwitchInt"),
163+
TerminatorKind::Terminate => Key("Terminate"),
164164
TerminatorKind::Unreachable => Key("Unreachable"),
165165
TerminatorKind::Yield { .. } => Key("Yield"),
166166
}

kani-compiler/src/kani_middle/attributes.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ pub fn extract_harness_attributes(tcx: TyCtxt, def_id: DefId) -> Option<HarnessA
155155
///
156156
/// TODO: Improve error message by printing the span of the callee instead of the definition.
157157
pub fn check_unstable_features(tcx: TyCtxt, enabled_features: &[String], def_id: DefId) {
158+
if !matches!(tcx.type_of(def_id).0.kind(), TyKind::FnDef(..)) {
159+
// skip closures due to an issue with rustc.
160+
// https://github.com/model-checking/kani/pull/2406#issuecomment-1534333862
161+
return;
162+
}
158163
let attributes = extract_kani_attributes(tcx, def_id);
159164
if let Some(unstable_attrs) = attributes.get(&KaniAttributeKind::Unstable) {
160165
for attr in unstable_attrs {

tests/cargo-ui/unstable-attr/invalid/expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: failed to parse `#[kani::unstable]`: expected "key = value" pair, but found `feature("invalid_args")`\
1+
error: failed to parse `#[kani::unstable]`: expected "key = value" pair, but found\
22
src/lib.rs\
33
|\
4-
| #[kani::unstable(feature("invalid_args"))]\
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\
4+
| #[kani::unstable(\
5+
| ^^^^^^^^^^^^^^^^^^\
66
|\
77
= note: expected format: #[kani::unstable(feature="<IDENTIFIER>", issue="<ISSUE>", reason="<DESCRIPTION>")]\
88
= note: this error originates in the attribute macro `kani::unstable` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/cargo-ui/unstable-attr/invalid/src/lib.rs

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

4+
//! All the unstable definitions below should fail.
5+
//! The expected file only contains a generic check since we trigger an ICE for debug builds and
6+
//! we don't guarantee the order that these will be evaluated.
7+
//! TODO: We should break down this test to ensure all of these fail.
8+
49
#[kani::unstable(reason = "just checking", issue = "<link>")]
510
pub fn missing_feature() {
611
todo!()

0 commit comments

Comments
 (0)