When mixing const generics and generic types for a function, it seems we have to add _ for the generic type:
use std::fmt::Debug;
fn foo1<const C: u8, const D: u8, T: Into<u16>+Debug>(a: T) {
let m = a.into();
println!("C={} D={} m={:?}", C, D, m);
}
fn foo2<T: Into<u16>+Debug>(a: T) {
let m = a.into();
println!("msg={:?}", m);
}
fn main() {
foo1::<1,2, _>(10_u8);
// the compiler is able to detect the type of T
foo2(11_u8);
// not compiling: the compiler is not able to detect the type of T
foo1::<1,2>(10_u8);
}
Is this being relaxed in the future to be able to not use the placeholder for the T parameter ?
I believe this is intentional. The function has 3 generic parameters, after all, so if you set out to specify them, it would be misleading to the reader of the code to see 2 arguments when there are 3 in reality.