rust-lang / lang-team

Home of the Rust lang team
http://lang-team.rust-lang.org/
Apache License 2.0
200 stars 48 forks source link

Experiment: Generic const items #214

Closed fmease closed 1 year ago

fmease commented 1 year ago

In the current version of Rust it is impossible to place generic parameters and where-clauses on free and associated constant items. This limits developers in their expressive power and renders certain desired functionality unattainable.

I hereby propose an experiment carried out by me in which the compiler gets extended to support generic const items addressing the aforementioned shortcoming of the language in an attempt to identify benefits and concerns in preparation for an RFC.

Motivation and use-cases

In no particular order:

Links

Initial people involved

scottmcm commented 1 year ago

As before, I'm happy to second/liason an experiment for this. We already have None::<i32> that sure looks like a generic const, so experimenting with a "real" version of that makes good sense to me.

cc @rust-lang/lang in case anyone wants to raise an objection.

scottmcm commented 1 year ago

@fmease We briefly raised this in the lang team meeting today, and there were still no objections, so the experiment is approved to move forward!