Skip to content

Remove AnonConstKind::GCA and reject generic anon consts#157773

Open
LaneAsade wants to merge 1 commit into
rust-lang:mainfrom
LaneAsade:generic_anon_consts
Open

Remove AnonConstKind::GCA and reject generic anon consts#157773
LaneAsade wants to merge 1 commit into
rust-lang:mainfrom
LaneAsade:generic_anon_consts

Conversation

@LaneAsade

Copy link
Copy Markdown
Member

Previously, a GCA type const (type const FOO<const N: usize>: usize = const { N + 1 };) was a type-system-transparent type const whose body immediately thunked out to an opaque regular const (albeit an anon const). The fact that there was a transparent wrapper wasn't providing anything of value, now that the user can write and #155341.

With this PR, GCA variant is removed from AnonConstKind so that generic anon consts are rejected.

Related: rust-lang/project-const-generics#113

@rustbot

rustbot commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

HIR ty lowering was modified

cc @fmease

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 11, 2026
@rustbot

rustbot commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, types
  • compiler, types expanded to 73 candidates
  • Random selection from 19 candidates

@rustbot

rustbot commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@LaneAsade

LaneAsade commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

I had to open a new PR as the other one closed for some reason and I am not able to reopen it. Sorry 😭

@LaneAsade LaneAsade force-pushed the generic_anon_consts branch 2 times, most recently from 1b1b90e to 4b1a86f Compare June 11, 2026 14:55
@BoxyUwU

BoxyUwU commented Jun 11, 2026

Copy link
Copy Markdown
Member

r? BoxyUwU

Comment thread tests/ui/const-generics/gca/basic.rs Outdated
@BoxyUwU

BoxyUwU commented Jun 11, 2026

Copy link
Copy Markdown
Member

dont worry about needing to open the second PR 😅 what happened is github doesn't let you re-open closed PRs if they've been pushed to since closing :3

@LaneAsade LaneAsade force-pushed the generic_anon_consts branch from 4b1a86f to 71523aa Compare June 12, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants