const blocks as a mod item#149174
Merged
rust-bors[bot] merged 6 commits intorust-lang:mainfrom Jan 24, 2026
Merged
Conversation
7ec6ad3 to
0b65188
Compare
This comment has been minimized.
This comment has been minimized.
0b65188 to
cd57dbd
Compare
This comment has been minimized.
This comment has been minimized.
16 tasks
cd57dbd to
2133ba3
Compare
This comment has been minimized.
This comment has been minimized.
2133ba3 to
c9880cd
Compare
This comment has been minimized.
This comment has been minimized.
c9880cd to
cb1f138
Compare
This comment has been minimized.
This comment has been minimized.
cb1f138 to
ccad7e5
Compare
Collaborator
|
Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt |
Collaborator
|
rustbot has assigned @jdonszelmann. Use |
ccad7e5 to
c62fe64
Compare
Contributor
|
@GrigorenkoPV feel like updating the last comments and finishing this up? |
50 tasks
fb3cacc to
ff7b2d1
Compare
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. |
ff7b2d1 to
d144915
Compare
ytmimi
reviewed
Jan 23, 2026
Comment on lines
+3
to
+4
| // ATTENTION: if we ever start accepting inner attributes here, make sure `rustfmt` can handle them. | ||
| // see: https://github.com/rust-lang/rustfmt/issues/6158 |
ytmimi
approved these changes
Jan 23, 2026
Contributor
Author
|
@rustbot ready |
Contributor
|
@bors r=me,ytmimi |
Contributor
Contributor
Author
rust-timer
added a commit
that referenced
this pull request
Jan 24, 2026
Rollup merge of #149174 - GrigorenkoPV:const_block_item, r=me,ytmimi `const` blocks as a `mod` item Tracking issue: #149226 This adds support for writing `const { ... }` as an item in a module. In the current implementation, this is a unique AST item that gets lowered to `const _: () = const { ... };` in HIR. rustfmt support included. TODO: - `pub const { ... }` does not make sense (see #147136). Reject it. Should this be rejected by the parser or smth? - Improve diagnostics (preferably they should not mention the fake `_` ident).
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Jan 25, 2026
Rollup of 4 pull requests Successful merges: - rust-lang/rust#149174 (`const` blocks as a `mod` item) - rust-lang/rust#151282 (THIR patterns: Explicitly distinguish `&pin` from plain `&`/`&mut`) - rust-lang/rust#151593 (miri subtree update) - rust-lang/rust#151516 (Do not emit errors on non-metaitem diagnostic attr input) r? @ghost
vinDelphini
pushed a commit
to vinDelphini/rust
that referenced
this pull request
Jan 25, 2026
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#149174 (`const` blocks as a `mod` item) - rust-lang#151282 (THIR patterns: Explicitly distinguish `&pin` from plain `&`/`&mut`) - rust-lang#151593 (miri subtree update) - rust-lang#151516 (Do not emit errors on non-metaitem diagnostic attr input) r? @ghost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracking issue: #149226
This adds support for writing
const { ... }as an item in a module. In the current implementation, this is a unique AST item that gets lowered toconst _: () = const { ... };in HIR.rustfmt support included.
TODO:
pub const { ... }does not make sense (see Add warn-by-default lint for visibility onconst _declarations #147136). Reject it. Should this be rejected by the parser or smth?_ident).