Module bridge
Internal interface for communicating between a proc_macro client
(a proc macro crate) and a proc_macro server (a compiler front-end).
Serialization (with C ABI buffers) and unique integer handles are employed
to allow safely interfacing between two copies of proc_macro built
(from the same source) by different compilers with potentially mismatching
Rust ABIs (e.g., stage0/bin/rustc vs stage1/bin/rustc during bootstrap).
Modules
-
arena
A minimal arena allocator inspired by
rustc_arena::DroplessArena. - buffer Buffer management for same-process client<->server communication.
- client Client-side types.
-
closure
Closure type (equivalent to
&mut dyn FnMut(Buffer) -> Buffer) that'srepr(C). -
fxhash
This is a copy of the
rustc_hashcrate, adapted to work as a module. - handle Server-side handles and storage for per-handle data.
- panic_message
- rpc Serialization for client-server communication.
-
selfless_reify
Abstraction for creating
fnpointers from any callable that effectively has the equivalent of implementingDefault, even if the compiler neither providesDefaultnor allows reifying closures (i.e. creatingfnpointers) other than those with absolutely no captures. - server Server-side traits.
- symbol Client-side interner used for symbols.
Structs
-
BridgeConfig
Configuration for establishing an active connection between a server and a
client. The server creates the bridge config (
run_serverinserver.rs), then passes it to the client through the function pointer in therunfield ofclient::Client. The client constructs a localBridgefrom the config in TLS during its execution (Bridge::{enter, with}inclient.rs). - DelimSpan
- Diagnostic
- ExpnGlobals Globals provided alongside the initial inputs for a macro expansion. Provides values such as spans which are used frequently to avoid RPC.
- Group
- Ident
- Literal
- Marked
- Methods
- Punct
Enums
- ApiTags
- LitKind
-
PanicMessage
Simplified version of panic payloads, ignoring
types other than
&'static strandString. - TokenTree
Traits
-
Mark
Helper to wrap associated types to allow trait impl dispatch.
That is, normally a pair of impls for
T::FooandT::Barcan overlap, but if the impls are, instead, on types likeMarked<T::Foo, Foo>andMarked<T::Bar, Bar>, they can't.
Macros
- compound_traits
- declare_tags
- mark_compound
- mark_noop
- with_api Higher-order macro describing the server RPC API, allowing automatic generation of type-safe Rust APIs, both client-side and server-side.