Not actually unconstrained const generic

I would like to be able to use (but not have to name) a const generic in a generic type, such as:

struct Generic<T>(::core::marker::PhantomData<T>);

trait NameConst<const N: usize> {}

impl<T: NameConst<N>, const N: usize> Generic<T> {}

The compiler error is pretty clear about the issue, but it is disappointing:

"proving the result of expressions other than the parameter are unique is not supported"

And here's a playground link, in case I'm missing something.

Unless I’m misunderstanding what you’re trying to do, you’d need to write it more like this, which also isn’t supported— likely because the only current way for a type to satisfy the bound would be ~264 explicit impls:

impl<T> Generic<T> where T: for<const N:usize> NameConst<N> {}

Well, yeah, more or less. To start with I do have a simple variety:

struct L<const N: usize>;

impl<const N: usize> NameConst<N> for L<N> {}

But also, more complex versions:

struct Complex<const N: usize, const A: bool, /* ... */, const F: bool>;

impl<const N: usize, const A: bool, /* ... */, const F: bool> 
NameConst<N> for Complex<N, A, B, C, D, E, F>
where
    // Lots of bounds to map bools to N
{}

And I don't want to have to do:

impl<const N: usize> Generic<L<N>> {}
impl<const N: usize, const A: bool, /* ... */, const F: bool> 
Generic<Complex<N, A, B, C, D, E, F>> 
where
    // So many bounds
{}

What about:

trait NameConst {
    const N:usize;
}

impl<T:NameConst> Generic for T {
    // T::N can be used here…
}

Oh, there's the issue. The const of the trait doesn't guarantee it's implemented for an equivalently unique type:

struct NoConst;

trait ConstTrait<const N: usize> {}

impl<const N: usize> ConstTrait<N> for NoConst {}

And that gave a clue to the solution! [playground]

Just need to name it as an associated type, not a generic:

impl<T: NameType<Assoc = L<N>>, const N: usize> Final for T {}