Rollup merge of #147792 - osamakader:fix-autodiff-proc-macro-lto, r=petrochenkov

Fix autodiff incorrectly applying fat-lto to proc-macro crates

Fixes rust-lang/rust#147487
This commit is contained in:
Matthias Krüger 2025-10-18 15:09:05 +02:00 committed by GitHub
commit 7fa2030d18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -603,7 +603,8 @@ impl Session {
// Autodiff currently requires fat-lto to have access to the llvm-ir of all (indirectly) used functions and types.
// fat-lto is the easiest solution to this requirement, but quite expensive.
// FIXME(autodiff): Make autodiff also work with embed-bc instead of fat-lto.
if self.opts.autodiff_enabled() {
// Don't apply fat-lto to proc-macro crates as they cannot use fat-lto without -Zdylib-lto
if self.opts.autodiff_enabled() && !self.opts.crate_types.contains(&CrateType::ProcMacro) {
return config::Lto::Fat;
}