Skip to content

Reject impl const Trait since the right syntax is const impl Trait now#158009

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
oli-obk:impl-const-impl-Trait
Jun 18, 2026
Merged

Reject impl const Trait since the right syntax is const impl Trait now#158009
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
oli-obk:impl-const-impl-Trait

Conversation

@oli-obk

@oli-obk oli-obk commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

I also let some smaller rustfmting of ui tests through, as rustfmt immediately formats impl const Trait to const impl Trait. This is also the reason I expect that this change will break very little nightly users, so we don't even need to add some helpful diagnostic.

r? @fee1-dead

@rustbot

rustbot commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @RalfJung, @lcnr

The parser was modified, potentially altering the grammar of (stable) Rust
which would be a breaking change.

cc @fmease

rustfmt is developed in its own repository. If possible, consider making this change to rust-lang/rustfmt instead.

cc @rust-lang/rustfmt

stdarch is developed in its own repository. If possible, consider making this change to rust-lang/stdarch instead.

cc @Amanieu, @folkertdev, @sayantn

@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. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jun 17, 2026
@rustbot

rustbot commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

fee1-dead is not on the review rotation at the moment.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the impl-const-impl-Trait branch from 4ee676c to b677ee5 Compare June 17, 2026 10:54
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the impl-const-impl-Trait branch from b677ee5 to a88521a Compare June 17, 2026 15:44
@rustbot rustbot added the T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. label Jun 17, 2026
@fee1-dead

Copy link
Copy Markdown
Member

rustfmt immediately formats impl const Trait to const impl Trait.

Only when we successfully parse it though, no?

@oli-obk

oli-obk commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

rustfmt immediately formats impl const Trait to const impl Trait.

Only when we successfully parse it though, no?

Well yes, it doesn't do so anymore after this change. But what I meant was that this has been the behaviour for a few months now, so everyone should be migrated.

@fee1-dead

Copy link
Copy Markdown
Member

To the 7.6k files on GitHub and many more elsewhere, sorry :3

https://github.com/search?q=%2Fimpl(%3C.*%3E)%3F+const+\w%2B(%3C.*%3E)%3F+for%2F+language%3ARust&type=code

//@ !has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where"]' '[const]'
//@ has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/div[@class="where"]' ': Fn'
impl<T: /* [const] */ Fn() /* + [const] Destruct */> const Tr<T> for T
const impl<T: /* [const] */ Fn() /* + [const] Destruct */> Tr<T> for T

@fee1-dead fee1-dead Jun 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test isn't even testing anything for now... we should fix that soon

View changes since the review

@fee1-dead

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a88521a has been approved by fee1-dead

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 18, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 18, 2026
Rollup of 12 pull requests

Successful merges:

 - #156795 (Handle generic reborrow in expression-use adjustment walking)
 - #157694 (Enhance documentation on wake call memory ordering)
 - #157935 (Make `proc_macro::ConversionErrorKind` non exhaustive)
 - #158002 (Replace `unwrap` with `expect` in `get_module_children`)
 - #158009 (Reject `impl const Trait` since the right syntax is `const impl Trait` now)
 - #158034 (Fix reborrow source expression visits)
 - #158072 (Bump thin-vec to 0.2.18 to address RUSTSEC-2026-0103)
 - #158074 (Document transient connection errors from TcpListener::accept)
 - #158077 (rustdoc-json-types: Replace bincode dev-dependency with postcard)
 - #158086 (renovate: Loosen dashboard approval and adopt recommended config)
 - #158088 (codegen_ssa: no dbginfo for scalable vec local w/ `-O0`)
 - #158089 (Fix invalid "jump-to-def" doc link generation when an item has a `derive` proc-macro)
@rust-bors rust-bors Bot merged commit c25ed44 into rust-lang:main Jun 18, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 18, 2026
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Jun 19, 2026
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#156795 (Handle generic reborrow in expression-use adjustment walking)
 - rust-lang/rust#157694 (Enhance documentation on wake call memory ordering)
 - rust-lang/rust#157935 (Make `proc_macro::ConversionErrorKind` non exhaustive)
 - rust-lang/rust#158002 (Replace `unwrap` with `expect` in `get_module_children`)
 - rust-lang/rust#158009 (Reject `impl const Trait` since the right syntax is `const impl Trait` now)
 - rust-lang/rust#158034 (Fix reborrow source expression visits)
 - rust-lang/rust#158072 (Bump thin-vec to 0.2.18 to address RUSTSEC-2026-0103)
 - rust-lang/rust#158074 (Document transient connection errors from TcpListener::accept)
 - rust-lang/rust#158077 (rustdoc-json-types: Replace bincode dev-dependency with postcard)
 - rust-lang/rust#158086 (renovate: Loosen dashboard approval and adopt recommended config)
 - rust-lang/rust#158088 (codegen_ssa: no dbginfo for scalable vec local w/ `-O0`)
 - rust-lang/rust#158089 (Fix invalid "jump-to-def" doc link generation when an item has a `derive` proc-macro)
kaidokert added a commit to kaidokert/c0nst that referenced this pull request Jun 20, 2026
rust-lang/rust#158009 removed the old
syntax, starting with nightly-2025-06-19.

This only updates the tests and docs, as the macro itself works fine.
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. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants