Rust: Tracking Issue for `min_const_generics`

Created on 28 Jul 2020  路  12Comments  路  Source: rust-lang/rust

This is a tracking issue for the minimal usable subset of RFC 2000 (rust-lang/rfcs#2000).
The feature gate for the issue is #![feature(min_const_generics)].

See rust-lang/lang-team#37 for more details.

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

Completed:

  • [x] should we keep allowing things like [u8; std::mem::size_of::<*mut T>()] here (cc #74595)
  • [x] how to deal with ConstKind::Unevaluated and incorrect inference cycles (cc #74040)

Implementation history

  • based of #44580
  • split into a separate feature gate in #74877
A-const-generics C-tracking-issue F-const_generics F-min_const_generics T-compiler T-lang

Most helpful comment

78433 is now complete 馃帀

All 12 comments

馃憢 I'm trying to understand the limitations of min_const_generics. Is it expected that https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=59cca2f3891e9fa921afdcbcda9f2588 compiles ok without min_const_generics, but fails with it?

:neutral_face: min_const_generics should not cause breaking changes, that's a bug. Opened #75486

We will most probably write a more detailed summary of what will be allowed with this feature in the near future, for now I can recommend the post by @withoutboats about this: https://without.boats/blog/shipping-const-generics/

In general, please note that a tracking issue is not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter.

Feel free to ping @lcnr (me) when opening a new issue concerning this feature.

Regarding some of the steps listed here:

  • For "const wf (generic params in associated consts)", what is the issue? #74877 specifically calls out that const ASSOC: usize = 64 / N; should work, so is this step about discussing whether or not it should be stabilized, or is it calling out something that hasn't been implemented yet? Can someone with more background open an issue that we can link to?
  • For the second step, can it be checked off now that #74595 is merged?
  • For "fix remaining blocking issues", do we have a list of these, or at least a vague upper bound on how many issues might exist? The F-min_const_generics label only lists three issues including this one, are either of the other two blocking?

I'm going to go through and triage the issues for F-min_const_generics soon, so we can get a better picture of what's remaining.

I've added several labels, and come up with a system to help us track what remains. It's slightly complicated, because we need to track three versions of Rust essentially: nightly, #![feature(min_const_generics)], and #![feature(const_generics)], which can all behave differently.

  • const-generics-blocking tracks any bug or non-diagnostics issue that is important enough that it ought to block stabilisation of min_const_generics (we can later reuse this label for const_generics).
  • const-generics-bad-diagnostics tracks issues where we emit unhelpful diagnostics that make const generics more difficult to use. I think these should be addressed before stabilisation of min_const_generics (at least where they make sense for min_const_generics).
  • const-generics-fixed-by-min_const_generics is a bug that occurs with or without a const_generics feature flag, which behaves correctly after enabling min_const_generics.
  • const-generics-fixed-by-const_generics is a bug that is fixed by enabling const_generics.

If an issue is marked with const-generics-fixed-by-min_const_generics and E-needs-test, we need to add a test for it under #[feature(min_const_generics)]. After adding the test, we can remove E-needs-test. If the test already works on nightly, then we can also remove const-generics-fixed-by-min_const_generics.

If an issue is marked with const-generics-fixed-by-const_generics and E-needs-test, we need to add a test for it under #[feature(const_generics)]. After adding the test, we can remove E-needs-test.

In summary, after addressing E-needs-test, if the issue still occurs on nightly or under #![feature(const_generics)], don't close the issue.


I'll try to deal with the current E-needs-test issues now, so no-one has to deal with my overly complicated labelling system immediately.

Regarding the remaining steps: there are only a handful of issues I think are blocking min_const_generics at this stage (several of which already have open pull requests). We also want to add many more tests, which is something anyone can easily help with. If you want to tackle one of the issues, feel free to ask @lcnr or myself how to get started; I'm going to dedicate time to fixing whichever remain.

I'm not sure if anything remains to be done with the WF bullet point: perhaps @lcnr could clarify?

@varkor I think you have an error in your previous comment.

If an issue is marked with const-generics-fixed-by-min_const_generics and E-needs-test, we need to add a test for it under #[feature(min_const_generics)]. After adding the test, we can remove E-needs-test.

is repeated...

@zserik: thanks!

If you want to tackle one of the issues, feel free to ask @lcnr or myself how to get started;

@lcnr and @varkor, I'd love to help out on this. Where can I start?

@jacobchrismarsh: thanks for offering (and sorry for taking so long to reply: it's been really busy on my end recently)! We seem to be wrapping up F-min_const_generics at the moment (all the existing issues have open PRs), so the last big thing remaining is improving the test suite coverage for the feature. We're going to plan out what kind of things we need to have tests for, and we can let you know when that's ready: we'd be eager to have help writing tests.

If you're keen to fix some bugs now, there are still a number of (non-min_)const_generics issues left. I think most of the bugs will require a little bit of investigation to fix, but there are still a few easier ones. Some examples are https://github.com/rust-lang/rust/issues/75763, https://github.com/rust-lang/rust/issues/65349 (for which there's an old PR you could revive and fix up), and https://github.com/rust-lang/rust/issues/61414. But feel free to take a look at any of the issues and comment there, and I'll try to give you pointers on how to get started!

Re the test coverage point, there is a tracking issue now for it: #78433

78433 is now complete 馃帀

Was this page helpful?
0 / 5 - 0 ratings