rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.02k stars 12.68k forks source link

bootstrap should be able to fully rely on RUSTC_WRAPPER #128383

Open RalfJung opened 2 months ago

RalfJung commented 2 months ago

With https://github.com/rust-lang/cargo/pull/13659, cargo now respects RUSTC_WRAPPER for all rustc invocations. So bootstrap should be able to set RUSTC to a non-existing binary and rely on RUSTC_WRAPPER for everything, which could simplift some logic.

See https://github.com/rust-lang/rust/pull/127682 for what that could look like. However, this is currently blocked on https://github.com/rust-lang/libc/issues/3772, and there are likely other components that also still use RUSTC (e.g. Miri and/or clippy might rely on it when running in x.py).

RalfJung commented 1 week ago

See https://github.com/rust-lang/rust/pull/127682 for my latest attempt, that I just gave up on. The rabbit hole goes deep as all sorts of places assume there is a rustc binary they can directly invoke, rather than going through a wrapper. I stopped when I realized compiletest also makes that assumption.

This makes me wonder if it wouldn't be easier to make bootstrap/bin/rustc just always be RUSTC and never the wrapper. Why is it used as a wrapper in the first place?