Expand description
Conservative parsing and action-key construction for rustc invocations.
The adapter deliberately rejects any compiler option whose effect on the
action key is unknown. Callers should treat BypassReason as a safe cache
bypass, run the real compiler, and avoid publishing an action result.
A typical integration parses an invocation, discovers precise inputs from
rustc dep-info with RustcInvocation::discover_inputs, adds them to an
ActionContext, and finally calls RustcInvocation::action. Path
mappings make workspace-local absolute paths stable across machines.
use mbx_cache_rustc::{PathMapping, normalize_mapped_path};
use std::path::Path;
let mappings = PathMapping::ordered(&[
PathMapping::new("/work/project", "workspace"),
]);
assert_eq!(
normalize_mapped_path(
Path::new("src/lib.rs"),
Path::new("/work/project"),
&mappings,
)?,
"${workspace}/src/lib.rs",
);Structs§
- Action
Context - External information needed to construct a canonical rustc action.
- Action
Input - One file input paired with the digest used in the action key.
- Compiler
Identity - Compiler properties that distinguish incompatible action outputs.
- DepInfo
Command - A side-effect-minimized rustc invocation that emits only dependency data.
- Discovered
Inputs - A complete, content-addressed compiler input manifest.
- Linker
Identity - What produced a linked native program, beyond the compiler itself.
- Parse
Options - What the caller is prepared to model beyond the default tier.
- Path
Mapping - Mapping from a host-specific absolute root to a stable key placeholder.
- Rustc
Action - Canonical action descriptor and its content digest.
- Rustc
DepInfo - The source and environment inputs reported by rustc’s dep-info output.
- Rustc
Input Prediction - Normalized input names from the last successful execution of one modeled rustc invocation.
- Rustc
Invocation - Parsed, cache-safe model of one
rustccommand line. - Rustc
Outputs - The cacheable files and dependency manifest produced by a rustc invocation.
Enums§
- Bypass
Reason - Reason an invocation cannot safely use the action cache.
Constants§
- ACTION_
SCHEMA_ VERSION - Schema version embedded in canonical rustc action descriptors.
- ADAPTER_
VERSION - Version of the rustc argument and input model used to construct keys.
Functions§
- normalize_
mapped_ path - Map an absolute path to its cache-key placeholder form.