1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#![allow(incomplete_features)] #![feature(generic_const_exprs)] trait Foo { const N: usize; } impl Foo for u8 { const N: usize = 1; } fn foo<T: Foo>(_: [u8; T::N]) -> T { todo!() } pub fn bar() { let _: u8 = foo([0; 1]); let _ = foo([0; 1]); //~^ ERROR type annotations needed } fn main() {}