#![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete struct PhantomU8; trait FxpStorage { type SInt; // Add arithmetic traits as needed. } macro_rules! fxp_storage_impls { ($($($n:literal)|+ => $sint:ty),* $(,)?) => { $($(impl FxpStorage for PhantomU8<$n> { type SInt = $sint; })*)* } } fxp_storage_impls! { 1 => i8, 2 => i16, 3 | 4 => i32, 5 | 6 | 7 | 8 => i64, 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 => i128, } type FxpStorageHelper = PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>; struct Fxp where FxpStorageHelper: FxpStorage, //~^ ERROR constant expression depends on a generic parameter { storage: as FxpStorage>::SInt, } fn main() { Fxp::<1, 15> { storage: 0i16 }; Fxp::<2, 15> { storage: 0i32 }; }