pub fn valid_ty_for_activity(ty: &P<Ty>, activity: DiffActivity) -> bool
Expand description
For indirections (ptr/ref) we can’t use Active, since Active allocates a shadow value for the given argument, but we generally can’t know the size of such a type. For scalar types (f16/f32/f64/f128) we can use Active and we can’t use Duplicated, since Duplicated expects a mutable ref/ptr and we would thus end up with a shadow value who is an indirect type, which doesn’t match the primal scalar type. We can’t prevent users here from marking scalars as Duplicated, due to type aliases.