2021-04-07 14:47:01 -05:00
|
|
|
//! Definitions shared by macros / syntax extensions and e.g. `rustc_middle`.
|
2019-10-09 16:47:38 +02:00
|
|
|
|
2024-04-29 08:53:45 +10:00
|
|
|
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
|
2024-07-29 08:13:50 +10:00
|
|
|
use rustc_span::def_id::DefId;
|
|
|
|
|
use rustc_span::symbol::Ident;
|
2023-03-10 22:39:14 +01:00
|
|
|
|
|
|
|
|
use crate::MetaItem;
|
|
|
|
|
|
2019-10-09 16:47:38 +02:00
|
|
|
pub mod allocator;
|
2023-03-10 22:39:14 +01:00
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Encodable, Decodable, HashStable_Generic)]
|
|
|
|
|
pub struct StrippedCfgItem<ModId = DefId> {
|
|
|
|
|
pub parent_module: ModId,
|
|
|
|
|
pub name: Ident,
|
|
|
|
|
pub cfg: MetaItem,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<ModId> StrippedCfgItem<ModId> {
|
|
|
|
|
pub fn map_mod_id<New>(self, f: impl FnOnce(ModId) -> New) -> StrippedCfgItem<New> {
|
|
|
|
|
StrippedCfgItem { parent_module: f(self.parent_module), name: self.name, cfg: self.cfg }
|
|
|
|
|
}
|
|
|
|
|
}
|