-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
In which we start to parse const generics defaults #80547
Conversation
Thanks @lqd — and thanks for the work on the parsing and lowering changes, @JulianKnodt! @bors r+ |
📌 Commit 583e7e4f13300946c88cf5393a585ec873cf38f9 has been approved by |
@bors r- Something was brought something to my attention regarding accidental stabilisation of the syntax. |
The issue I had overlooked is that we're feature gating too liberally here, in that the new syntax will not be forbidden under There's an example in this PR: https://github.com/rust-lang/rust/pull/63545/files @lqd: sorry for overlooking this. Would you be able to make the changes and add a new test for |
@varkor sure ! |
Thanks! @bors r+ |
📌 Commit d02ac5a4bf01151b68e25ccc10d43293c4990cd6 has been approved by |
☔ The latest upstream changes (presumably #80459) made this pull request unmergeable. Please resolve the merge conflicts. |
d02ac5a
to
2a01264
Compare
@bors r=varkor |
📌 Commit 2a012649d6df03f1ea1ee078effe44842d79b29e has been approved by |
Rollup of 8 pull requests Successful merges: - rust-lang#80323 (Update and improve `rustc_codegen_{llvm,ssa}` docs) - rust-lang#80368 (rustdoc: Render visibilities succinctly) - rust-lang#80514 (Fix broken ./x.py install) - rust-lang#80519 (Take type defaults into account in suggestions to reorder generic parameters) - rust-lang#80526 (Update LLVM) - rust-lang#80532 (remove unnecessary trailing semicolon from bootstrap) - rust-lang#80548 (FIx ICE on wf check for foreign fns) - rust-lang#80551 (support pattern as const parents in type_of) Failed merges: - rust-lang#80547 (In which we start to parse const generics defaults) r? `@ghost` `@rustbot` modify labels: rollup
☔ The latest upstream changes (presumably #80566) made this pull request unmergeable. Please resolve the merge conflicts. |
- Adds optional default values to const generic parameters in the AST and HIR - Parses these optional default values - Adds a `const_generics_defaults` feature gate
The `const_generics_defaults` now handles them, and they correctly parse, so we can update these tests expecting a parser error .
This is important to not accidentally stabilize the parsing of the syntax while it still is experimental and not formally accepted
2a01264
to
942b7ce
Compare
@bors r=varkor |
📌 Commit 942b7ce has been approved by |
☀️ Test successful - checks-actions |
As discussed in this zulip topic, this PR extracts the parsing parts from @JulianKnodt's PR #75384 for a better user-experience using the newly stabilized
min_const_generics
(albeit temporary) as shown in #80507: trying to use default values on const generics currently results in parse errors, as if the user didn't use the correct syntax (which is somewhat true but also misleading).This PR extracts (and slightly modifies in a couple places) @JulianKnodt's parsing code (with attribution if I've done everything correctly), AST and HIR changes, and feature gate setup.
This feature is now marked as "incomplete" and thus will also print out the expected "const generics default values are unstable" error instead of a syntax error. Note that, as I've only extracted the parsing part, the actual feature will not work at all if enabled. There will be ICEs, and inference errors on the const generics default values themselves.
Fixes #80507.
Once this merges, I'll:
const_generics_defaults
gate rather than the older temporary name it uses there.F-const_generics_defaults
labelr? @varkor