It could, but it doesn't scale well to multiple #[cfg]
cases.
#[cfg(all(not(feature = "first"), not(feature = "second")))]
type MySoA = VariadicSoa<
TypeA,
TypeB,
TypeC,
TypeD,
>;
#[cfg(all(feature = "first", not(feature = "second")))]
type MySoA = VariadicSoa<
TypeA,
TypeB,
TypeC,
TypeD,
TypeE,
>;
#[cfg(all(not(feature = "first"), feature = "second"))]
type MySoA = VariadicSoa<
TypeA,
TypeB,
TypeC,
TypeD,
TypeF,
>;
#[cfg(all(feature = "first", feature = "second"))]
type MySoA = VariadicSoa<
TypeA,
TypeB,
TypeC,
TypeD,
TypeE,
TypeF,
>;
It would certainly preferable to be able to do
type MySoA = VariadicSoa<
TypeA,
TypeB,
TypeC,
TypeD,
#[cfg(feature = "first")] TypeE,
#[cfg(feature = "second")] TypeF,
>;
This can already be done with non-variadic types, I just want to make sure it's accounted for in the grammar for variadics as well. There are a handful of lexical positions where #[cfg]
isn't allowed largely out of oversight, and probably should be permitted -- RFC 3399 is one such example.