rustc_ast/expand/
mod.rs

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