mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-27 02:53:43 +00:00
fix autodiff macro on generic functions
heloo there!
This short PR allows applying the `autodiff` macro to generic functions like this one.
It only touches the frontend part, since the `rustc_autodiff` macro can already handle generics.
```rust
#[autodiff(d_square, Reverse, Duplicated, Active)]
fn square<T: std::ops::Mul<Output = T> + Copy>(x: &T) -> T {
*x * *x
}
```
Thanks to Manuel for creating an issue on this. For more information on this see #140032
r? `@ZuseZ4`
As always: thanks for any piece of feedback!!
Fixes: #140032
Tracking issue for autodiff: https://github.com/rust-lang/rust/issues/124509