From b3739f3c0e86a217599f78d99920867f30afdd18 Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Sat, 19 Apr 2025 03:36:02 -0400 Subject: [PATCH] Only consider MonoItem::Fn when preventing inlining for autodiff source functions --- compiler/rustc_monomorphize/src/partitioning.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index b1b6f10e0fe2c..d7690a96e10de 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -254,8 +254,9 @@ where always_export_generics, ); - // We can't differentiate something that got inlined. + // We can't differentiate a function that got inlined. let autodiff_active = cfg!(llvm_enzyme) + && matches!(mono_item, MonoItem::Fn(_)) && cx .tcx .codegen_fn_attrs(mono_item.def_id())