pub struct Args {
pub proc_macro: bool,
pub edition: Option<String>,
pub deps: Vec<Dependency>,
pub ui: UiExpectations,
}Expand description
Arguments accepted by the #[subcrate] attribute, e.g.
#[subcrate(proc_macro, edition = "2018", other_subcrate)].
The attribute takes a flat, comma-separated list. Each argument is one of:
proc_macro(orproc_macro = true) — compile as aproc-macrocrate.edition = "2018"— compile with this edition.path::to::dep— depend on the sibling subcrate at that module path, visible inside this subcrate under the path’s last segment.alias = path::to::dep— the same, visible underalias.::name(oralias = ::name) — an external crate: one the owning package depends on, or — ifnameis the package’s own library — the owner crate itself. The build helper has Cargo build it for the subcrate. It is visible inside the subcrate undername(oralias).
The remaining arguments turn the subcrate into a UI test — a build-time
assertion about the diagnostics rustc produces for it. Each may be given more
than once, and every one must hold (they are combined with AND — e.g. two
should_error = "…" require a matching error for each string):
should_error— the subcrate must fail to compile. Anyshould_errormakes it expected to fail, so it produces no artifact and its module expands to an empty stand-in. With= "…"an error’s rendered text must also contain that string.should_warn— the subcrate must emit at least one warning. With= "…"a warning’s rendered text must contain that string.should_spanned = "…"— some diagnostic must underline source code equal to this string once whitespace is removed from both sides. (A value is required.)
Fields§
§proc_macro: boolCompile the module as a proc-macro crate rather than an ordinary
library crate.
edition: Option<String>Compile the subcrate with this edition instead of the owning package’s.
deps: Vec<Dependency>The crates this subcrate links against, in the order written.
ui: UiExpectationsThe UI-test expectations (should_error/should_warn/should_spanned).
Implementations§
Source§impl Args
impl Args
Sourcepub fn is_ui_test(&self) -> bool
pub fn is_ui_test(&self) -> bool
Whether these arguments make the subcrate a UI test (any should_*).
Sourcepub fn expects_error(&self) -> bool
pub fn expects_error(&self) -> bool
Whether the subcrate is expected to fail to compile (any should_error),
so it produces no artifact.