-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Equality constraints on associated constants #70256
Copy link
Copy link
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-trait-systemArea: Trait systemArea: Trait systemA-type-systemArea: Type systemArea: Type systemC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.F-const_generics`#![feature(const_generics)]``#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-trait-systemArea: Trait systemArea: Trait systemA-type-systemArea: Type systemArea: Type systemC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.F-const_generics`#![feature(const_generics)]``#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
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::AssocTyConstraintKindas:cc @varkor @eddyb