-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Equality constraints on associated constants #70256
Comments
I've assigned myself, as I will be fixing the parser / lowering aspects of this to start with. |
Move arg/constraint partition check to validation & improve recovery - In the first commit, we move the check rejecting e.g., `<'a, Item = u8, String>` from the parser into AST validation. - We then use this to improve the code for parsing generic arguments. - And we add recovery for e.g., `<Item = >` (missing), `<Item = 42>` (constant), and `<Item = 'a>` (lifetime). This is also preparatory work for supporting rust-lang#70256. r? @varkor
Any progress on this issue? I see the required changes were made in March, so it seems to be possible to add this feature for now? |
I believe only (some of) the parsing aspects were addressed, and nothing more. There is still implementation left before this feature is even ready for a feature gate. |
…-obk allow eq constraints on associated constants Updates rust-lang#70256 (cc `@varkor,` `@Centril)`
…-obk allow eq constraints on associated constants Updates rust-lang#70256 (cc `@varkor,` `@Centril)`
This has been implemented in nightly, so I am closing this feature request in favor of the tracking issue at #92827. Per #92827 (comment), a lang team MCP is eventually going to be required, along with some medium sized doc explaining what is going on and why. @oli-obk will open a hackmd for folks to collaborate in. |
We currently do not support any way to constrain an associated constant as needing to be equal to some constant value. The natural way to achieve this would be to, by analogy with e.g.,
Foo<0>
, also allowFoo<ID = 0>
. The same disambiguation rules would apply as forFoo<X>
in terms of when a block{ ... }
is needed, e.g.,Foo<ID = { N + 1 }>
.In compiler internal terms, we would redefine
ast::AssocTyConstraintKind
as:cc @varkor @eddyb
The text was updated successfully, but these errors were encountered: