Struct rustc_expand::base::ExtCtxt[][src]

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: FxHashMap<Span, Vec<String>>,
    pub(crate) extern_mod_loaded: Option<&'a dyn Fn(Ident, Vec<Attribute>, Vec<P<Item>>, Span) -> (Vec<Attribute>, Vec<P<Item>>)>,
    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: FxHashMap<Span, Vec<String>>extern_mod_loaded: Option<&'a dyn Fn(Ident, Vec<Attribute>, Vec<P<Item>>, Span) -> (Vec<Attribute>, Vec<P<Item>>)>

Called directly after having parsed an external mod foo; in expansion.

Ident is the module name.

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.

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).

Resolves a path mentioned inside Rust code, returning an absolute path.

This unifies the logic used for resolving include_X!.

FIXME: move this to rustc_builtin_macros and make it private.

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

Performs the conversion.

Performs the conversion.

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 be different between compiler versions and platforms. 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: 256 bytes