The project is here in which stable Rust emits a nightly compilation flag -Zshare-generics from nowhere.
This happens on Ubuntu, but not on Windows (though the stable Rust on Windows is a bit older, it's v1.78.0). sccache is used on both tested platforms.
$ rustup default stable
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.78.0 (9b00956e5 2024-04-29)
$ cargo c
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `/root/.cargo/bin/sccache
/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc -
--crate-name ___ --print=file-names -Clink-arg=-fuse-ld=lld
-Zshare-generics=y --crate-type bin --crate-type rlib --crate-type dylib
--crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot
--print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
--- stderr
error: the option `Z` is only accepted on the nightly compiler
help: consider switching to a nightly toolchain: `rustup default nightly`
note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see <https://rust-lang.github.io/rustup/concepts/index.html>
note: for more information about Rust's stability policy, see <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features>
error: 1 nightly option were parsed