building your own rustc_driver
a day ago
- Running `cargo clippy` involves multiple indirections: rustup proxies, cargo extensions, and clippy-driver, as shown by strace output.
- Rustup proxies are hardlinks to rustup that dispatch to the correct toolchain binary based on the executable name.
- Building a custom rustc_driver requires adding the `rustc-dev` component and handling shared library loading via `LD_LIBRARY_PATH` or `-rpath`.
- A custom driver can override compiler queries, such as disabling the unsafe checker by setting `check_unsafety` to a no-op.
- To make the driver respect toolchain versions, a shell script using the `readlink` trick can dispatch to the correct binary.