Skip to content

Commit 7fa2030

Browse files
authored
Rollup merge of #147792 - osamakader:fix-autodiff-proc-macro-lto, r=petrochenkov
Fix autodiff incorrectly applying fat-lto to proc-macro crates Fixes #147487
2 parents 063b26a + e67d502 commit 7fa2030

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/rustc_session/src/session.rs

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

0 commit comments

Comments
 (0)