pub struct ExtCtxt<'a> {
    pub sess: &'a Session,
    pub ecfg: ExpansionConfig<'a>,
    pub reduced_recursion_limit: Option<Limit>,
    pub root_path: PathBuf,
    pub resolver: &'a mut dyn ResolverExpand,
    pub current_expansion: ExpansionData,
    pub force_mode: bool,
    pub expansions: FxIndexMap<Span, Vec<String>>,
    pub(crate) lint_store: Option<&'a (dyn LintStoreExpand + 'a)>,
    pub buffered_early_lint: Vec<BufferedEarlyLint>,
    pub(crate) expanded_inert_attrs: MarkedAttrs,
}
Expand description

One of these is made during expansion and incrementally updated as we go; when a macro expansion occurs, the resulting nodes have the backtrace() -> expn_data of their expansion context stored into their span.

Fields

sess: &'a Sessionecfg: ExpansionConfig<'a>reduced_recursion_limit: Option<Limit>root_path: PathBufresolver: &'a mut dyn ResolverExpandcurrent_expansion: ExpansionDataforce_mode: bool

Error recovery mode entered when expansion is stuck (or during eager expansion, but that’s a hack).

expansions: FxIndexMap<Span, Vec<String>>lint_store: Option<&'a (dyn LintStoreExpand + 'a)>

Used for running pre-expansion lints on freshly loaded modules.

buffered_early_lint: Vec<BufferedEarlyLint>

Used for storing lints generated during expansion, like NAMED_ARGUMENTS_USED_POSITIONALLY

expanded_inert_attrs: MarkedAttrs

When we ‘expand’ an inert attribute, we leave it in the AST, but insert it here so that we know not to expand it again.

Implementations

Returns a Folder for deeply expanding all macros in an AST node.

Returns a Folder that deeply expands all macros and assigns all NodeIds in an AST node. Once NodeIds are assigned, the node may not be expanded, removed, or otherwise modified.

Returns the current expansion kind’s description.

Equivalent of Span::def_site from the proc macro API, except that the location is taken from the span passed as an argument.

Equivalent of Span::call_site from the proc macro API, except that the location is taken from the span passed as an argument.

Equivalent of Span::mixed_site from the proc macro API, except that the location is taken from the span passed as an argument.

Returns span for the macro which originally caused the current expansion to happen.

Stops backtracing at include! boundary.

Emit msg attached to sp, without immediately stopping compilation.

Compilation will be stopped in the near future (at the end of the macro expansion phase).

[expr1, expr2, ...]

&[expr1, expr2, ...]

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

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: 304 bytes