Skip to content

Rip out rustc_layout_scalar_valid_range_* attribute support#155433

Merged
rust-bors[bot] merged 6 commits intorust-lang:mainfrom
oli-obk:bye-bye-long-attribute
May 3, 2026
Merged

Rip out rustc_layout_scalar_valid_range_* attribute support#155433
rust-bors[bot] merged 6 commits intorust-lang:mainfrom
oli-obk:bye-bye-long-attribute

Conversation

@oli-obk
Copy link
Copy Markdown
Contributor

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

View all comments

And either removes tests for it or replaces the uses with pattern types.

primarily fixes #135996

fixes #147761
fixes #133652

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 17, 2026

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred to the CTFE machinery

cc @RalfJung, @lcnr

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

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

cc @rust-lang/rust-analyzer

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. labels Apr 17, 2026
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. labels Apr 17, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 17, 2026

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
  • compiler expanded to 72 candidates
  • Random selection from 18 candidates

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Happy to review this
Love the branch name 🤣

r? me

Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

Please revert the rust-analyzer changes. r-a needs to support old compilers, and also it doesn't even properly support pattern types yet.

View changes since this review

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 17, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 17, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 17, 2026
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the bye-bye-long-attribute branch from c6053aa to cc13e2c Compare April 17, 2026 19:20
@mejrs
Copy link
Copy Markdown
Contributor

mejrs commented Apr 17, 2026

There is some prose in the dev guide that will no longer apply.

The other complicated safety check is for writes to fields of layout constrained structs (such as NonNull). These are found by looking for the borrow or assignment expression and then visiting the subexpression being borrowed or assigned with a separate visitor.

https://rustc-dev-guide.rust-lang.org/unsafety-checking.html?other-checks-involving-unsafe

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@oli-obk oli-obk force-pushed the bye-bye-long-attribute branch from cc13e2c to 663f77e Compare April 21, 2026 07:08
@rustbot

This comment has been minimized.

@oli-obk oli-obk force-pushed the bye-bye-long-attribute branch from 663f77e to c01a244 Compare April 21, 2026 07:09
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 21, 2026

The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes.

cc @BoxyUwU, @tshepang

@rustbot rustbot added the A-rustc-dev-guide Area: rustc-dev-guide label Apr 21, 2026
@oli-obk oli-obk force-pushed the bye-bye-long-attribute branch from c01a244 to 07e6d54 Compare April 21, 2026 07:18
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the bye-bye-long-attribute branch from 07e6d54 to cbd6780 Compare April 21, 2026 09:42
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the bye-bye-long-attribute branch from cbd6780 to 4fb465f Compare April 21, 2026 12:16
@oli-obk oli-obk force-pushed the bye-bye-long-attribute branch from ac6aef6 to 11d88ee Compare May 3, 2026 09:01
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 3, 2026

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.

@oli-obk
Copy link
Copy Markdown
Contributor Author

oli-obk commented May 3, 2026

@bors try jobs=aarch64-msvc-1

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 3, 2026
Rip out rustc_layout_scalar_valid_range_* attribute support


try-job: aarch64-msvc-1
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 3, 2026

☀️ Try build successful (CI)
Build commit: 3eeae45 (3eeae452f25cf4a3f8b4366878f7a926589ff5e4, parent: 44860d3e9ef700cac0b4a61d924f41f46bf1b447)

@ShoyuVanilla
Copy link
Copy Markdown
Member

@bors r=RalfJung,ShoyuVanilla rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 3, 2026

📌 Commit 11d88ee has been approved by RalfJung,ShoyuVanilla

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 3, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 3, 2026
…RalfJung,ShoyuVanilla

Rip out rustc_layout_scalar_valid_range_* attribute support

And either removes tests for it or replaces the uses with pattern types.

primarily fixes rust-lang#135996

fixes rust-lang#147761
fixes rust-lang#133652
rust-bors Bot pushed a commit that referenced this pull request May 3, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - #156073 ([rustdoc] Fix `doc_cfg` feature on reexports)
 - #155433 (Rip out rustc_layout_scalar_valid_range_* attribute support)
 - #155957 (Revert const hacks and use const closures in std)
@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Just in case
@bors try jobs=dist-i586-gnu-i586-i686-musl

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 3, 2026
Rip out rustc_layout_scalar_valid_range_* attribute support


try-job: dist-i586-gnu-i586-i686-musl
rust-bors Bot pushed a commit that referenced this pull request May 3, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #156073 ([rustdoc] Fix `doc_cfg` feature on reexports)
 - #152216 (Fix 'assign to data in an index of' collection suggestions)
 - #155433 (Rip out rustc_layout_scalar_valid_range_* attribute support)
 - #156098 (Hand-implement `impl Debug for NumBuffer` to avoid constraining `T` or printing MaybeUninit)
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 3, 2026

☀️ Try build successful (CI)
Build commit: fbdd0e8 (fbdd0e8994078c1ae7d692f98df45174d073b8e2, parent: 54f67d248b14af80be8f3adc2094dd4a84ec2115)

@rust-bors rust-bors Bot merged commit 081e7c4 into rust-lang:main May 3, 2026
12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone May 3, 2026
rust-timer added a commit that referenced this pull request May 3, 2026
Rollup merge of #155433 - oli-obk:bye-bye-long-attribute, r=RalfJung,ShoyuVanilla

Rip out rustc_layout_scalar_valid_range_* attribute support

And either removes tests for it or replaces the uses with pattern types.

primarily fixes #135996

fixes #147761
fixes #133652
@Kobzol
Copy link
Copy Markdown
Member

Kobzol commented May 3, 2026

Looks like this broke our runtime benchmarks in rustc-perf, lol.

Cannot compile runtime benchmark nbody

Caused by:
    0: Failed to compile runtime benchmark `nbody`
    1: Failed to run cargo, exit code 101
       /home/collector/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.20/src/backend/linux_raw/io/errno.rs:28:25: error: attributes starting with `rustc` are reserved for use by the `rustc` compiler
       /home/collector/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.20/src/backend/linux_raw/io/errno.rs:29:25: error: attributes starting with `rustc` are reserved for use by the `rustc` compiler
       /home/collector/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.20/src/backend/linux_raw/io/errno.rs:28:25: error: cannot find attribute `rustc_layout_scalar_valid_range_start` in this scope
       /home/collector/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.20/src/backend/linux_raw/io/errno.rs:29:25: error: cannot find attribute `rustc_layout_scalar_valid_range_end` in this scope

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

This is because the rustix crate uses rustc internal attributes 💀
https://github.com/bytecodealliance/rustix/blob/9f588bc922f98d19fdb1f44cdb17f190d239b0eb/src/backend/linux_raw/io/errno.rs#L49

github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request May 4, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#156073 ([rustdoc] Fix `doc_cfg` feature on reexports)
 - rust-lang/rust#152216 (Fix 'assign to data in an index of' collection suggestions)
 - rust-lang/rust#155433 (Rip out rustc_layout_scalar_valid_range_* attribute support)
 - rust-lang/rust#156098 (Hand-implement `impl Debug for NumBuffer` to avoid constraining `T` or printing MaybeUninit)
pull Bot pushed a commit to xtqqczze/rust-lang-miri that referenced this pull request May 4, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#156073 ([rustdoc] Fix `doc_cfg` feature on reexports)
 - rust-lang/rust#152216 (Fix 'assign to data in an index of' collection suggestions)
 - rust-lang/rust#155433 (Rip out rustc_layout_scalar_valid_range_* attribute support)
 - rust-lang/rust#156098 (Hand-implement `impl Debug for NumBuffer` to avoid constraining `T` or printing MaybeUninit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustc-dev-guide Area: rustc-dev-guide S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue.

Projects

None yet