The Rust team has decided that const generics should be interchangeable with type parameters Const generics MVP hits beta! | Rust Blog
We actually think a more flexible approach would be to allow default arguments for const generics as well as for type parameters, in the current order. You see, types are types, and consts are consts, so the compiler is never gonna parse a type as a const or a const as a type. That is to say, you should just be able to have
fn foo<A, B = (), const X: usize, const Y: usize = 20>() {...}
and it just, work. because foo::<Type, CONST>
is unambiguous, and foo::<Type, Type, CONST>
would also work, and so would foo::<Type, CONST, CONST>
. You still keep the rules of both "types come before consts" (and the user-friendliness that comes with) and "defaults come last", but you tweak the latter to be "defaults come last per kind".