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

Aperta
#3,086 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
[…]
Lingua principale
Rust
Stelle
8k
Fork
835
Merge medio
3g 6h
PR unite (30g)
60

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mozilla/sccache

Tutte le issue di mozilla/sccache

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.