Struct rustc_span::hygiene::HygieneData
source · pub(crate) 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: UnhashMap<Hash64, 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: UnhashMap<Hash64, 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
fn with<T, F: FnOnce(&mut HygieneData) -> T>(f: F) -> T
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 walk_chain_collapsed( &self, span: Span, to: Span, collapse_debuginfo_feature_enabled: bool ) -> 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 DynSend for HygieneData
impl DynSync for HygieneData
impl Freeze for HygieneData
impl RefUnwindSafe for HygieneData
impl Send for HygieneData
impl Sync for HygieneData
impl Unpin for HygieneData
impl UnwindSafe for HygieneData
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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