-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
const blocks as a mod item
#149174
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
const blocks as a mod item
#149174
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.
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
|
Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt |
|
rustbot has assigned @jdonszelmann. Use |
ccad7e5 to
c62fe64
Compare
|
@GrigorenkoPV feel like updating the last comments and finishing this up? |
fb3cacc to
ff7b2d1
Compare
|
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
| // ATTENTION: if we ever start accepting inner attributes here, make sure `rustfmt` can handle them. | ||
| // see: https://github.com/rust-lang/rustfmt/issues/6158 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 🙏🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good for the rustfmt changes
|
@rustbot ready |
|
@bors r=me,ytmimi |
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).
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
…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
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).