You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Investigate min_generic_const_args for handling array sizes generically #180
It seems like min_const_generic_args could be the missing compiler feature we need to be able to use the associated constant typenum::Unsigned::USIZE as N for [T; N] when defining our Array type.
It would be good to try to make this work on nightly in a proof-of-concept capacity to ensure it will actually work for our use cases. It would also make a compelling use case for min_const_generic_args.
i would be really interested in understanding your use case for more const generics related features, as well as specifically how mGCA may (or may not) fit into that. feel free to reach out on the rust-lang zulip or poke me here about anything, i'd be more than happy to try and understand what you've got going on :)
Per Zulip it seems like this was prototyped successfully using the following definition of Array which becomes possible with with min_const_generic_args:
pubstructArray<T,U:Unsigned>(pub[T;U::USIZE]);
Hooray! Well there's one complication: it requires upstream changes to typenum to use the type const syntax in order for this to work. On the tracking issue for min_const_generic_args I see there's an unresolved question "Can we get rid of needing an annotation on const items for them being type consts?" so if that goes away this will be much easier.
I suppose another thing to consider is min_const_generic_args largely eliminates the impetus for hybrid-array in the first place, where our main usage of hybrid-array and typenum is simply providing associated "constants" (i.e. typenum type-level unsigned integers) that are used to size arrays, and if we have that as a first-class feature in the language in cases where we don't depend on typenum type-level arithmetic expressed as bounds we can simply migrate to core arrays.
For cases where we currently do depend on such arithmetic or other typenum predicates, I know @andrewwhitehead has been working on defining traits in terms of const generics without use of typenum which provide some of that functionality.
Activity
BoxyUwU commentedon Apr 15, 2026
i would be really interested in understanding your use case for more const generics related features, as well as specifically how mGCA may (or may not) fit into that. feel free to reach out on the rust-lang zulip or poke me here about anything, i'd be more than happy to try and understand what you've got going on :)
tarcieri commentedon May 2, 2026
Per Zulip it seems like this was prototyped successfully using the following definition of
Arraywhich becomes possible with withmin_const_generic_args:Hooray! Well there's one complication: it requires upstream changes to
typenumto use thetype constsyntax in order for this to work. On the tracking issue formin_const_generic_argsI see there's an unresolved question "Can we get rid of needing an annotation on const items for them being type consts?" so if that goes away this will be much easier.I suppose another thing to consider is
min_const_generic_argslargely eliminates the impetus forhybrid-arrayin the first place, where our main usage ofhybrid-arrayandtypenumis simply providing associated "constants" (i.e.typenumtype-level unsigned integers) that are used to size arrays, and if we have that as a first-class feature in the language in cases where we don't depend ontypenumtype-level arithmetic expressed as bounds we can simply migrate to core arrays.For cases where we currently do depend on such arithmetic or other
typenumpredicates, I know @andrewwhitehead has been working on defining traits in terms of const generics without use oftypenumwhich provide some of that functionality.