Skip to content

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

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
LaneAsade:generic_anon_consts
Jun 13, 2026
Merged

Remove AnonConstKind::GCA and reject generic anon consts#157773
rust-bors[bot] merged 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
@BoxyUwU

BoxyUwU commented Jun 12, 2026

Copy link
Copy Markdown
Member

@bors r+

thanks for working on this :)

@rust-bors

rust-bors Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 71523aa has been approved by BoxyUwU

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 12, 2026
samueltardieu added a commit to samueltardieu/rust that referenced this pull request Jun 12, 2026
…oxyUwU

Remove AnonConstKind::GCA and reject generic anon consts

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 rust-lang#155341.

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

Related: rust-lang/project-const-generics#113
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 13, 2026
…oxyUwU

Remove AnonConstKind::GCA and reject generic anon consts

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 rust-lang#155341.

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

Related: rust-lang/project-const-generics#113
rust-bors Bot pushed a commit that referenced this pull request Jun 13, 2026
Rollup of 7 pull requests

Successful merges:

 - #157653 (remove AliasTerm::def_id())
 - #157773 (Remove AnonConstKind::GCA and reject generic anon consts)
 - #157740 (rustdoc: correct doctest span for trailing semicolon after item)
 - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`)
 - #157802 (Ensure that optimize attributes on closures are inherited by the shim.)
 - #157812 (rustc_public: implement `ty::Alias` conversion)
 - #157833 (Update wasm-component-ld to 0.5.25)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 13, 2026
…oxyUwU

Remove AnonConstKind::GCA and reject generic anon consts

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 rust-lang#155341.

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

Related: rust-lang/project-const-generics#113
rust-bors Bot pushed a commit that referenced this pull request Jun 13, 2026
Rollup of 9 pull requests

Successful merges:

 - #157653 (remove AliasTerm::def_id())
 - #157773 (Remove AnonConstKind::GCA and reject generic anon consts)
 - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums)
 - #157514 ([tiny] Use multipart suggestion for finding ident when literal was expected in attr)
 - #157740 (rustdoc: correct doctest span for trailing semicolon after item)
 - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`)
 - #157802 (Ensure that optimize attributes on closures are inherited by the shim.)
 - #157812 (rustc_public: implement `ty::Alias` conversion)
 - #157833 (Update wasm-component-ld to 0.5.25)
rust-bors Bot pushed a commit that referenced this pull request Jun 13, 2026
Rollup of 10 pull requests

Successful merges:

 - #157714 (Improve polymorphization of raw pointer formatting)
 - #157653 (remove AliasTerm::def_id())
 - #157773 (Remove AnonConstKind::GCA and reject generic anon consts)
 - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums)
 - #157594 (note which target a missing target_feature belongs to)
 - #157740 (rustdoc: correct doctest span for trailing semicolon after item)
 - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`)
 - #157802 (Ensure that optimize attributes on closures are inherited by the shim.)
 - #157812 (rustc_public: implement `ty::Alias` conversion)
 - #157833 (Update wasm-component-ld to 0.5.25)
rust-bors Bot pushed a commit that referenced this pull request Jun 13, 2026
Rollup of 10 pull requests

Successful merges:

 - #157714 (Improve polymorphization of raw pointer formatting)
 - #157653 (remove AliasTerm::def_id())
 - #157773 (Remove AnonConstKind::GCA and reject generic anon consts)
 - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums)
 - #157594 (note which target a missing target_feature belongs to)
 - #157740 (rustdoc: correct doctest span for trailing semicolon after item)
 - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`)
 - #157802 (Ensure that optimize attributes on closures are inherited by the shim.)
 - #157812 (rustc_public: implement `ty::Alias` conversion)
 - #157833 (Update wasm-component-ld to 0.5.25)
@rust-bors rust-bors Bot merged commit ffb0b60 into rust-lang:main Jun 13, 2026
12 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 13, 2026
rust-timer added a commit that referenced this pull request Jun 13, 2026
Rollup merge of #157773 - LaneAsade:generic_anon_consts, r=BoxyUwU

Remove AnonConstKind::GCA and reject generic anon consts

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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