Workaround for const_evaluatable_checked on stable?

FWIW, another option is not to use const_generics yet, and keep using the poor man's equivalent that most crypto libs use:

fn main ()
{
    use ::generic_array::{arr, typenum::consts::*};

    let _: [f32; 1] = lib::foo::<U4>([1., 2., 3., 4.].into()).into();

    let _: [f32; 1] = lib::foo(arr![f32; 1., 2., 3., 4.]).into();
}

mod lib {
    pub
    fn foo<N: ConstUsize> (input: Array_f32<N>)
      -> Array_f32<op!(N / U4)>
    where
        // [(); N / 4]:,
        N : ::core::ops::Div<U4>, op!(N / U4) : ConstUsize,
    {
        let fst = input[0];
        todo!()
    }

    …
}
2 Likes