actions-rust-lang/Setup Rust Toolchain for GitHub CI

Setup specific Rust versions with caching pre-configured. It provides problem matchers for cargo and rustfmt issues.

View on GitHub

Trust Signals

Scorecard Score
not yet scored
Maintenance Recency
Activelast commit Jun 25, 2026
License
MIT

Pinned Snippet

workflow.ymlSHA-pinned
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0

tags can be moved; commit SHAs can't. why a SHA?

namedescriptionrequireddefault
toolchainComma-separated list of Rust toolchain specifications. Last version becomes the default. -- see https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specificationno
targetTarget triple to install for this toolchainno
componentsComma-separated list of components to be additionally installedno
cacheAutomatically configure Rust cachenotrue
cache-workspacesPaths to multiple Cargo workspaces and their target directories, separated by newlines.no
cache-directoriesAdditional non workspace directories to be cached, separated by newlines.no
cache-on-failureCache even if the build fails.notrue
cache-keyAn additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs.no
cache-shared-keyA cache key that is used instead of the automatic `job`-based key, and is stable over multiple jobs.no
cache-binDetermines whether to cache ${CARGO_HOME}/bin.notrue
cache-providerDetermines which provider to use for caching. Options are github, buildjet, or warpbuild. Defaults to github.nogithub
cache-all-cratesDetermines which crates are cached. If `true` all crates will be cached, otherwise only dependent crates will be cached.nofalse
cache-workspace-cratesDetermines which crates are cached. If `true` all crates will be cached, otherwise only dependent crates will be cached.nofalse
cache-save-ifDetermines whether the cache should be saved. If `false`, the cache is only restored.notrue
cache-targetsDetermines whether workspace targets are cached. If `false`, only the cargo registry will be cached.notrue
matcherEnable the Rust problem matchernotrue
rustflagsset RUSTFLAGS environment variable, set to empty string to avoid overwriting build.rustflagsno-D warnings
overrideSetup the last installed toolchain as the default via `rustup override`notrue
rust-src-dirSpecify path from root directory to the Rust source directory. By default root directory will be used.no
namedescription
rustc-versionVersion as reported by `rustc --version`
cargo-versionVersion as reported by `cargo --version`
rustup-versionVersion as reported by `rustup --version`
cachekeyA short hash of the rustc version, appropriate for use as a cache key. "20220627a831"