• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //! Definitions shared by macros / syntax extensions and e.g. `rustc_middle`.
2 
3 use rustc_span::{def_id::DefId, symbol::Ident};
4 
5 use crate::MetaItem;
6 
7 pub mod allocator;
8 
9 #[derive(Debug, Clone, Encodable, Decodable, HashStable_Generic)]
10 pub struct StrippedCfgItem<ModId = DefId> {
11     pub parent_module: ModId,
12     pub name: Ident,
13     pub cfg: MetaItem,
14 }
15 
16 impl<ModId> StrippedCfgItem<ModId> {
map_mod_id<New>(self, f: impl FnOnce(ModId) -> New) -> StrippedCfgItem<New>17     pub fn map_mod_id<New>(self, f: impl FnOnce(ModId) -> New) -> StrippedCfgItem<New> {
18         StrippedCfgItem { parent_module: f(self.parent_module), name: self.name, cfg: self.cfg }
19     }
20 }
21