@@ -12,21 +12,15 @@ fn adjust_activity_to_abi<'tcx>(tcx: TyCtxt<'tcx>, fn_ty: Ty<'tcx>, da: &mut Vec
1212 if !matches ! ( fn_ty. kind( ) , ty:: FnDef ( ..) ) {
1313 bug ! ( "expected fn def for autodiff, got {:?}" , fn_ty) ;
1414 }
15- let fnc_binder: ty:: Binder < ' _ , ty:: FnSig < ' _ > > = fn_ty. fn_sig ( tcx) ;
1615
17- // If rustc compiles the unmodified primal, we know that this copy of the function
18- // also has correct lifetimes. We know that Enzyme won't free the shadow too early
19- // (or actually at all), so let's strip lifetimes when computing the layout.
20- let x = tcx . instantiate_bound_regions_with_erased ( fnc_binder ) ;
16+ // We don't actually pass the types back into the type system.
17+ // All we do is decide how to handle the arguments.
18+ let sig = fn_ty . fn_sig ( tcx ) . skip_binder ( ) ;
19+
2120 let mut new_activities = vec ! [ ] ;
2221 let mut new_positions = vec ! [ ] ;
23- for ( i, ty) in x . inputs ( ) . iter ( ) . enumerate ( ) {
22+ for ( i, ty) in sig . inputs ( ) . iter ( ) . enumerate ( ) {
2423 if let Some ( inner_ty) = ty. builtin_deref ( true ) {
25- if ty. is_fn_ptr ( ) {
26- // FIXME(ZuseZ4): add a nicer error, or just figure out how to support them,
27- // since Enzyme itself can handle them.
28- tcx. dcx ( ) . err ( "function pointers are currently not supported in autodiff" ) ;
29- }
3024 if inner_ty. is_slice ( ) {
3125 // We know that the length will be passed as extra arg.
3226 if !da. is_empty ( ) {
0 commit comments