Skip to content

Commit 5143a9b

Browse files
Skip CrateItems that of GlobalAsm kind to avoid triggering a panic in stable MIR
1 parent 15fb14d commit 5143a9b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

kani-compiler/src/kani_middle/reachability.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ where
8383
crate_items
8484
.iter()
8585
.filter_map(|item| {
86+
// avoid stable MIR panic
87+
// https://github.com/rust-lang/project-stable-mir/issues/95
88+
if let Some(instance) = Instance::try_from(*item).ok() {
89+
let int_def_id = rustc_internal::internal(tcx, instance.def.def_id());
90+
if matches!(tcx.def_kind(int_def_id), rustc_hir::def::DefKind::GlobalAsm) {
91+
return None;
92+
}
93+
};
8694
// Only collect monomorphic items.
8795
matches!(item.kind(), ItemKind::Fn)
8896
.then(|| {

0 commit comments

Comments
 (0)