-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic associated consts can't currently be used to parameterize fixed array lengths #42863
Comments
It should be written "associated consts can't be used as an argument to fixed size arrays" :) parameters != arguments :P |
This is a known issue mentioned in the tracking issue for associated constants. |
Indeed, this appears to be similar to #39211 and #34344, though the fact there are four different compiler error messages between these three issues suggests these are exercising different paths. Would be nice to consolidate all four code examples into one issue for the sake of regression tests, if someone wants to arbitrarily pick one. |
Is this any closer to being fixed? |
Closing as duplicate of #43408. @alfriadox The canonical issue is #43408, and while it's closer to being fixed, @nikomatsakis hasn't really let people attack the problem directly for the past few years, so it's been a waiting game. |
The following program works, proving that associated consts ought to be able to be used to successfully parameterize the size of fixed-length arrays:
The following program ought to compile as well, but doesn't:
Output:
Slightly altering the program to more fully qualify the associated const also doesn't work, though yields a different error message:
Output:
Presumably both these programs should work, yes?
The text was updated successfully, but these errors were encountered: