Skip to main content

Module wrapper

Module wrapper 

Source
Expand description

The RUSTC_WRAPPER of the instrumented build.

Only workspace crates are instrumented: instrumenting wasmtime and cranelift made every wasm compile in the suite several times slower, and their records were thrown away anyway. RUSTFLAGS cannot say “workspace only”, so cargo runs this executable in front of every rustc. A crate whose manifest lives under the workspace root gets -Cinstrument-coverage appended and still goes through the wrapper the environment had before: the flag is then part of sccache’s argv, hence of its cache key, so an instrumented artifact is never stored under a key that lacks it. Everything else goes through that wrapper unchanged.

A compilation with an explicit --target is left alone as well: the suite starts wasm32 builds, and that target has no profiler runtime.

RUSTC_WORKSPACE_WRAPPER would not do: cargo nests it inside RUSTC_WRAPPER, so sccache would sit outside it.

Structs§

Invocation 🔒
The program and arguments to run in place of the wrapper itself.

Constants§

COVERAGE_FLAG 🔒
PREVIOUS_VAR 🔒
Presence switches main into wrapper mode; the value is the wrapper that was set before, possibly empty.
ROOT_VAR 🔒

Functions§

cross_compiles 🔒
intercept
Runs as the wrapper when the marker is set and cargo’s call shape matches. None means this is a normal xtask invocation, including one a test spawned under the marker it inherited; Some is only ever the failure to start rustc, because success replaces this process.
is_rustc_call 🔒
Cargo runs $RUSTC_WRAPPER <rustc> <args…>, the rustc being a path or a bare name; an xtask invocation starts with a subcommand instead.
plan 🔒
argv is what cargo passed: the rustc to run, then its arguments.
split 🔒
wrapper_env 🔒
The environment that makes cargo route every rustc through this executable.