Dependent const generics

Hello,

I'm trying to give my type some bounds like this:

struct Foo<T, const MIN: T,  const MAX: T>(pub T);

Currently this is not possible because const generics are not allowed to depend on any other generic types. Is there any way around the this restriction?

The only way this could possibly work is if it's already been implemented on nightly. If it is, it'll be feature gated since it isn't stable yet.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.