@@ -254,20 +254,18 @@ where
254254 always_export_generics,
255255 ) ;
256256
257- // TODO: This currently crashes compilation:
258- // thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:242:1:
259- // DefId(2:45681 ~ core[1460]::iter::adapters::copied::Copied) does not have a "codegen_fn_attrs"
260- //
261257 // We can't differentiate something that got inlined.
262- let autodiff_active = cfg ! ( llvm_enzyme) && {
263- characteristic_def_id
264- . and_then ( |def_id| cx. tcx . codegen_fn_attrs ( def_id) . autodiff_item . as_ref ( ) )
265- . is_some_and ( |ad| ad. is_active ( ) )
266- } ;
267-
268- //if !autodiff_active && visibility == Visibility::Hidden && can_be_internalized {
269- // internalization_candidates.insert(mono_item);
270- //}
258+ let autodiff_active = cfg ! ( llvm_enzyme)
259+ && cx
260+ . tcx
261+ . codegen_fn_attrs ( mono_item. def_id ( ) )
262+ . autodiff_item
263+ . as_ref ( )
264+ . is_some_and ( |ad| ad. is_active ( ) ) ;
265+
266+ if !autodiff_active && visibility == Visibility :: Hidden && can_be_internalized {
267+ internalization_candidates. insert ( mono_item) ;
268+ }
271269 let size_estimate = mono_item. size_estimate ( cx. tcx ) ;
272270
273271 cgu. items_mut ( ) . insert ( mono_item, MonoItemData {
@@ -1275,7 +1273,9 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> MonoItemPartitio
12751273 MonoItem :: Fn ( ref instance_s) => {
12761274 let source_id = instance_s. def_id ( ) ;
12771275 //if tcx.autodiff_attrs(source_id).is_active() {
1278- if let Some ( ad) = & tcx. codegen_fn_attrs ( source_id) . autodiff_item && ad. is_active ( ) {
1276+ if let Some ( ad) = & tcx. codegen_fn_attrs ( source_id) . autodiff_item
1277+ && ad. is_active ( )
1278+ {
12791279 return Some ( instance_s) ;
12801280 }
12811281 None
0 commit comments