sccache now includes experimental support for caching Rust compilation. This includes many caveats, and is primarily focused on caching rustc invocations as produced by cargo. A (possibly-incomplete) list follows:
dep-infoare supported as
linkmust be present.
-o fileis not supported.
- Compilation from stdin is not supported, a source file must be provided.
- Values from
env!will not be tracked in caching.
- Procedural macros that read files from the filesystem may not be cached properly
- Target specs aren't hashed (e.g. custom target specs)
If you are using Rust 1.18 or later, you can ask cargo to wrap all compilation with sccache by setting
RUSTC_WRAPPER=sccache in your build environment.