With RUSTC=rustc, client-side mode skips RUSTC_WORKSPACE_WRAPPER, and server-side mode passes a compile without one as if wrapped

Open
#3,086 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
56/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Start by running the linked gist reproducer with a fresh sccache server in both client-side and server-side modes. Trace how sccache handles RUSTC_WORKSPACE_WRAPPER when RUSTC=rustc, and compare those paths with Cargo's behavior in the reproducer. Done means all four sccache checks match Cargo alone: the wrapper enables the compile, and omitting it produces the expected compile error.

Written by the indexing model from the issue text.

Description

I found this when cargo dylint, which sets its lint driver as RUSTC_WORKSPACE_WRAPPER, printed none of its lint warnings once RUSTC_WRAPPER=sccache was set.

Steps

Reproducer: https://gist.github.com/YevheniiKotyrlo/3a1d15d595b2c113c559d9ad0587633a

git clone https://gist.github.com/YevheniiKotyrlo/3a1d15d595b2c113c559d9ad0587633a sccache-workspace-wrapper
cd sccache-workspace-wrapper
bash repro.sh /path/to/sccache

repro.sh builds wrapper.rs, a stand-in for a lint driver such as dylint-driver that runs the toolchain's rustc with --cfg wrapped added. It then runs cargo check with RUSTC=rustc on a crate whose lib.rs is

#[cfg(not(wrapped))]
compile_error!("RUSTC_WORKSPACE_WRAPPER did not run");

with and without RUSTC_WORKSPACE_WRAPPER: first without sccache, then with RUSTC_WRAPPER=sccache under SCCACHE_CLIENT_SIDE=1 and under SCCACHE_CLIENT_SIDE=0, each mode on a new server and an empty cache.

Expected

Each cargo check through sccache ends as it does without sccache: exit 0 with the wrapper, and error: RUSTC_WORKSPACE_WRAPPER did not run without it.

Actual

In client-side mode the cargo check with the wrapper fails as if no wrapper were set, and in server-side mode the cargo check without the wrapper passes, which only the wrapper's --cfg wrapped allows:

[…]
summary (sccache 0.20.1):
  cargo alone, wrapper: exit 0, the wrapper ran
  cargo alone, no wrapper: exit 101, RUSTC_WORKSPACE_WRAPPER did not run
  sccache client-side, wrapper: exit 101, RUSTC_WORKSPACE_WRAPPER did not run, where cargo alone ends exit 0, the wrapper ran
  sccache client-side, no wrapper: exit 101, RUSTC_WORKSPACE_WRAPPER did not run, as cargo alone
  sccache server-side, wrapper: exit 0, the wrapper ran, as cargo alone
  sccache server-side, no wrapper: exit 0, the wrapper ran, where cargo alone ends exit 101, RUSTC_WORKSPACE_WRAPPER did not run
verdict: 2 of 4 compiles through sccache end otherwise than cargo alone (exit 1)

Versions

  • sccache built from main at 9f8aff3 (it reports sccache 0.20.1); the v0.20.1 release binary prints the same summary
  • rustc and cargo 1.100.0 through rustup, run from Git Bash on Windows; the run's first line:
system: MINGW64_NT-10.0-26300 3.6.10-5a1665c8.x86_64 x86_64; sccache 0.20.1; cargo 1.100.0 (3acc79c0c 2026-11-05); rustc 1.100.0 (0ef1bc386 2026-11-09); host x86_64-pc-windows-msvc
[…]
Dominant language
Rust
Stars
8k
Forks
835
Avg merge
3d 6h
Merged PRs (30d)
60

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/sccache

All issues in mozilla/sccache

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.