Skip to content

Commit 51678e9

Browse files
authored
Fix --emit mir handling of constants (rust-lang#3276)
It shouldn't assume that the body of statics are available otherwise the compiler will ICE.
1 parent 1aee91f commit 51678e9

File tree

1 file changed

+4
-1
lines changed
  • kani-compiler/src/kani_middle

1 file changed

+4
-1
lines changed

kani-compiler/src/kani_middle/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ pub fn dump_mir_items(
105105
match item {
106106
// Exclude FnShims and others that cannot be dumped.
107107
MonoItem::Fn(instance) => Some(*instance),
108-
MonoItem::Static(def) => Some((*def).into()),
108+
MonoItem::Static(def) => {
109+
let instance: Instance = (*def).into();
110+
instance.has_body().then_some(instance)
111+
}
109112
MonoItem::GlobalAsm(_) => None,
110113
}
111114
}

0 commit comments

Comments
 (0)