Struct rustc_span::hygiene::HygieneData
source · pub struct HygieneData {
local_expn_data: IndexVec<LocalExpnId, Option<ExpnData>>,
local_expn_hashes: IndexVec<LocalExpnId, ExpnHash>,
foreign_expn_data: FxHashMap<ExpnId, ExpnData>,
foreign_expn_hashes: FxHashMap<ExpnId, ExpnHash>,
expn_hash_to_expn_id: UnhashMap<ExpnHash, ExpnId>,
syntax_context_data: Vec<SyntaxContextData>,
syntax_context_map: FxHashMap<(SyntaxContext, ExpnId, Transparency), SyntaxContext>,
expn_data_disambiguators: FxHashMap<u64, u32>,
}
Fields§
§local_expn_data: IndexVec<LocalExpnId, Option<ExpnData>>
Each expansion should have an associated expansion data, but sometimes there’s a delay
between creation of an expansion ID and obtaining its data (e.g. macros are collected
first and then resolved later), so we use an Option
here.
local_expn_hashes: IndexVec<LocalExpnId, ExpnHash>
§foreign_expn_data: FxHashMap<ExpnId, ExpnData>
Data and hash information from external crates. We may eventually want to remove these maps, and fetch the information directly from the other crate’s metadata like DefIds do.
foreign_expn_hashes: FxHashMap<ExpnId, ExpnHash>
§expn_hash_to_expn_id: UnhashMap<ExpnHash, ExpnId>
§syntax_context_data: Vec<SyntaxContextData>
§syntax_context_map: FxHashMap<(SyntaxContext, ExpnId, Transparency), SyntaxContext>
§expn_data_disambiguators: FxHashMap<u64, u32>
Maps the local_hash
of an ExpnData
to the next disambiguator value.
This is used by update_disambiguator
to keep track of which ExpnData
s
would have collisions without a disambiguator.
The keys of this map are always computed with ExpnData.disambiguator
set to 0.
Implementations§
source§impl HygieneData
impl HygieneData
pub(crate) fn new(edition: Edition) -> Self
pub fn with<T, F: FnOnce(&mut HygieneData) -> T>(f: F) -> T
fn local_expn_hash(&self, expn_id: LocalExpnId) -> ExpnHash
fn expn_hash(&self, expn_id: ExpnId) -> ExpnHash
fn local_expn_data(&self, expn_id: LocalExpnId) -> &ExpnData
fn expn_data(&self, expn_id: ExpnId) -> &ExpnData
fn is_descendant_of(&self, expn_id: ExpnId, ancestor: ExpnId) -> bool
fn normalize_to_macros_2_0(&self, ctxt: SyntaxContext) -> SyntaxContext
fn normalize_to_macro_rules(&self, ctxt: SyntaxContext) -> SyntaxContext
fn outer_expn(&self, ctxt: SyntaxContext) -> ExpnId
fn outer_mark(&self, ctxt: SyntaxContext) -> (ExpnId, Transparency)
fn parent_ctxt(&self, ctxt: SyntaxContext) -> SyntaxContext
fn remove_mark(&self, ctxt: &mut SyntaxContext) -> (ExpnId, Transparency)
fn marks(&self, ctxt: SyntaxContext) -> Vec<(ExpnId, Transparency)> ⓘ
fn walk_chain(&self, span: Span, to: SyntaxContext) -> Span
fn adjust(&self, ctxt: &mut SyntaxContext, expn_id: ExpnId) -> Option<ExpnId>
fn apply_mark(
&mut self,
ctxt: SyntaxContext,
expn_id: ExpnId,
transparency: Transparency
) -> SyntaxContext
fn apply_mark_internal(
&mut self,
ctxt: SyntaxContext,
expn_id: ExpnId,
transparency: Transparency
) -> SyntaxContext
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for HygieneData
impl !Send for HygieneData
impl !Sync for HygieneData
impl Unpin for HygieneData
impl UnwindSafe for HygieneData
Blanket Implementations§
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 232 bytes