cargo
Rust Locked and offline builds
Use --locked to refuse a change to the lockfile and --offline to prevent Cargo network access. Offline availability still depends on local source/cache; build scripts are not sandboxed by this flag. Generate the fixture lockfile first. Example format: shell; run from a disposable copy of v15/fixtures/projects/local-app. Expected result (not executed): Both commands succeed using only the supplied local dependencies. Why: The first command fixes the dependency graph; the second refuses resolution changes. Common mistake: Thinking --offline alone ensures the same resolution across machines.
Formal Syntax & Structure
rust syntaxrust
cargo build --locked --offlineWorking Example
Example Snippetrust
cargo generate-lockfile --offlinecargo build --locked --offline