-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Error using associated constant in return type of generic function #56605
Labels
A-associated-items
Area: Associated items (types, constants & functions)
A-const-generics
Area: const generics (parameters and arguments)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Comments
Even worse, we suggest the code that's already there in the following case:
|
Seems to be a variation of #56605 |
Ran into this bug and suspect the related bug he meant to link was #43408 |
With current latest toolchain:
the sample code
does not compile but the errors given are completely different:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-associated-items
Area: Associated items (types, constants & functions)
A-const-generics
Area: const generics (parameters and arguments)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Consider the following code:
The compiler will error with:
Now there is a clear constraint on T, meaning that LEN should be valid. I'm guessing the return type is being evaluated before the constraint, whereas it should check after, at which point it would know this this ought to be valid.
Tested in 1.31 stable and 1.32 nightly (Dec 7 2018)
The text was updated successfully, but these errors were encountered: