Skip to content

Commit

Permalink
update def_id_iter
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Dec 8, 2021
1 parent 05805f8 commit ccb1eae
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions compiler/rustc_middle/src/mir/mono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,14 @@ impl MonoItemMap<'tcx> {
}

pub fn def_id_iter<'a>(&'a self) -> impl Iterator<Item = DefId> + 'a {
self.all_items().filter_map(|mono_item| match mono_item {
MonoItem::Fn(instance) => Some(instance.def_id()),
MonoItem::Static(def_id) => Some(def_id),
_ => None,
})
self.trivially_concrete
.iter()
.filter_map(|&mono_item| match mono_item {
MonoItem::Fn(instance) => Some(instance.def_id()),
MonoItem::Static(def_id) => Some(def_id),
_ => None,
})
.chain(self.item_map.iter().map(|(&def, _)| def.def_id()))
}

pub fn contains(&self, item: MonoItem<'tcx>) -> bool {
Expand Down

0 comments on commit ccb1eae

Please sign in to comment.