pub(crate) struct Rustc<'a, 'b> {
    ecx: &'a mut ExtCtxt<'b>,
    def_site: Span,
    call_site: Span,
    mixed_site: Span,
    krate: CrateNum,
    rebased_spans: FxHashMap<usize, Span>,
}

Fields§

§ecx: &'a mut ExtCtxt<'b>§def_site: Span§call_site: Span§mixed_site: Span§krate: CrateNum§rebased_spans: FxHashMap<usize, Span>

Implementations§

Trait Implementations§

🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
Intern a symbol received from RPC
🔬This is a nightly-only experimental API. (proc_macro_internals)
Recover the string value of a symbol, and invoke a callback with it.
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)

Saves the provided span into the metadata of the crate we are currently compiling, which must be a proc-macro crate. This id can be passed to recover_proc_macro_span when our current crate is run as a proc-macro.

Let’s suppose that we have two crates - my_client and my_proc_macro. The my_proc_macro crate contains a procedural macro my_macro, which is implemented as: quote! { "hello" }

When we compile my_proc_macro, we will execute the quote proc-macro. This will save the span of “hello” into the metadata of my_proc_macro. As a result, the body of my_proc_macro (after expansion) will end up containing a call that looks like this: proc_macro::Ident::new("hello", proc_macro::Span::recover_proc_macro_span(0))

where 0 is the id returned by this function. When my_proc_macro executes (during the compilation of my_client), the call to recover_proc_macro_span will load the corresponding span from the metadata of my_proc_macro (which we have access to, since we’ve loaded my_proc_macro from disk in order to execute it). In this way, we have obtained a span pointing into my_proc_macro

🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)
🔬This is a nightly-only experimental API. (proc_macro_internals)

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