Expand description
Shared logic between the subcrate build helper and the subcrate-macros
procedural macro.
The two sides never talk to each other. They only have to agree, on their own,
about one thing: the internal crate name a given #[subcrate] module
compiles to. The build helper uses it to name the rustc output; the
procedural macro uses it in the extern crate binding that loads that output.
Both derive the name from the module’s identifier and body alone, so they
always reach the same answer with no coordination.
Structs§
- Args
- Arguments accepted by the
#[subcrate]attribute, e.g.#[subcrate(proc_macro, edition = "2018", other_subcrate)]. - Dependency
- One dependency of a subcrate, as written in
#[subcrate(...)]. - UiExpectations
- A subcrate’s UI-test expectations: assertions about the diagnostics
rustcproduces for it, from#[subcrate(should_error/should_warn/should_spanned …)].
Enums§
- Manifest
Entry - What the build helper recorded for a subcrate in its manifest.
Constants§
- INTERNAL_
PREFIX - The prefix of every generated internal crate name.
- SKIPPED_
MARKER - The reserved first field marking a manifest line as a skipped subcrate (one
whose
#[rustversion]gate kept it from building on the current toolchain). A real dependency field is alwaysalias=path, and an alias is an identifier, so this!-prefixed token can never collide with one.
Functions§
- canonical_
body - Produces a canonical text form of a module body.
- inner_
attrs - Returns the crate-level inner attributes (
#![…]) of a module body — the ones that belong on the subcrate’s crate root, such as#![no_std]or#![allow(…)]. - internal_
crate_ name - Computes the internal crate name for a
#[subcrate]module. - is_
subcrate_ attr - Returns
trueifattris the#[subcrate]attribute. - manifest_
line - Renders one line of the build helper’s manifest: the subcrate’s internal name,
then one tab-separated
alias=path::to::depper resolved dependency. - manifest_
lookup - Finds the manifest line for
internal(seemanifest_line) and returns what the helper recorded for it, orNoneif the subcrate is not listed. - parse_
attr_ args - Parses the
Argscarried by a#[subcrate(...)]attribute as it appears in parsed source (used by the build helper). - skipped_
manifest_ line - Renders the manifest line for a subcrate the helper skipped because its
#[rustversion]gate did not build on the current toolchain (seeManifestEntry::Skipped).
Type Aliases§
- Resolved
Dep - A sibling dependency of a subcrate that the build helper resolved under the same crate root, as recorded in the manifest: the name it is visible under (the alias) and its module path from that root.