Skip to main content

Crate mbx_cache_rustc

Crate mbx_cache_rustc 

Source
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§

ActionContext
External information needed to construct a canonical rustc action.
ActionInput
One file input paired with the digest used in the action key.
CompilerIdentity
Compiler properties that distinguish incompatible action outputs.
DepInfoCommand
A side-effect-minimized rustc invocation that emits only dependency data.
DiscoveredInputs
A complete, content-addressed compiler input manifest.
LinkerIdentity
What produced a linked native program, beyond the compiler itself.
ParseOptions
What the caller is prepared to model beyond the default tier.
PathMapping
Mapping from a host-specific absolute root to a stable key placeholder.
RustcAction
Canonical action descriptor and its content digest.
RustcDepInfo
The source and environment inputs reported by rustc’s dep-info output.
RustcInputPrediction
Normalized input names from the last successful execution of one modeled rustc invocation.
RustcInvocation
Parsed, cache-safe model of one rustc command line.
RustcOutputs
The cacheable files and dependency manifest produced by a rustc invocation.

Enums§

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