1 //! Validity checking for fake lang items
3 use crate::def_id::DefId;
4 use crate::{lang_items, LangItem, LanguageItems};
6 use rustc_data_structures::fx::FxHashMap;
7 use rustc_span::symbol::{sym, Symbol};
9 use lazy_static::lazy_static;
11 macro_rules! fake_lang_items {
12 ($($item:ident, $name:ident, $method:ident;)*) => (
15 pub static ref FAKE_ITEMS_REFS: FxHashMap<Symbol, LangItem> = {
16 let mut map = FxHashMap::default();
17 $(map.insert(sym::$name, lang_items::$item);)*
23 pub fn is_fake_lang_item(&self, item_def_id: DefId) -> bool {
24 let did = Some(item_def_id);
26 $(self.$method() == did)||*
33 // Variant name, Symbol, Method name,
34 CountCodeRegionFnLangItem, count_code_region, count_code_region_fn;
35 CoverageCounterAddFnLangItem, coverage_counter_add, coverage_counter_add_fn;
36 CoverageCounterSubtractFnLangItem, coverage_counter_subtract, coverage_counter_subtract_fn;