Skip to main content

Crate subcrate_core

Crate subcrate_core 

Source
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 rustc produces for it, from #[subcrate(should_error/should_warn/should_spanned …)].

Enums§

ManifestEntry
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 always alias=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 true if attr is 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::dep per resolved dependency.
manifest_lookup
Finds the manifest line for internal (see manifest_line) and returns what the helper recorded for it, or None if the subcrate is not listed.
parse_attr_args
Parses the Args carried 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 (see ManifestEntry::Skipped).

Type Aliases§

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