Skip to content

Commit

Permalink
use monoitems instead of internalmonoitems
Browse files Browse the repository at this point in the history
  • Loading branch information
ouz-a committed Nov 15, 2023
1 parent d2523aa commit d4c51ab
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions kani-compiler/src/kani_middle/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@ use std::fmt::Display;
/// - Total number of MIR instructions.
pub fn print_stats<'tcx>(tcx: TyCtxt<'tcx>, items: &[InternalMonoItem<'tcx>]) {
rustc_internal::run(tcx, || {
let items: Vec<MonoItem> = items.iter().map(rustc_internal::stable).collect();
let item_types = items.iter().collect::<Counter>();
let visitor = items
.iter()
.filter_map(|&mono| {
if let MonoItem::Fn(instance) = rustc_internal::stable(&mono) {
Some(instance)
} else {
None
}
})
.filter_map(
|mono| {
if let MonoItem::Fn(instance) = mono { Some(instance) } else { None }
},
)
.fold(StatsVisitor::default(), |mut visitor, body| {
visitor.visit_body(&body.body());
visitor
Expand Down Expand Up @@ -120,12 +119,12 @@ impl<T: Into<Key>> FromIterator<T> for Counter {
#[derive(Debug, Eq, Hash, PartialEq)]
struct Key(pub &'static str);

impl<'tcx> From<&InternalMonoItem<'tcx>> for Key {
fn from(value: &InternalMonoItem) -> Self {
impl From<&MonoItem> for Key {
fn from(value: &stable_mir::mir::mono::MonoItem) -> Self {
match value {
InternalMonoItem::Fn(_) => Key("function"),
InternalMonoItem::GlobalAsm(_) => Key("global assembly"),
InternalMonoItem::Static(_) => Key("static item"),
MonoItem::Fn(_) => Key("function"),
MonoItem::GlobalAsm(_) => Key("global assembly"),
MonoItem::Static(_) => Key("static item"),
}
}
}
Expand Down

0 comments on commit d4c51ab

Please sign in to comment.