Skip to content

Rename #[unroll] => #[rustc_unroll] to mitigate nameres ambiguity - #160211

Merged
rust-bors[bot] merged 5 commits into
rust-lang:mainfrom
jieyouxu:froot-loops
Aug 6, 2026
Merged

Rename #[unroll] => #[rustc_unroll] to mitigate nameres ambiguity#160211
rust-bors[bot] merged 5 commits into
rust-lang:mainfrom
jieyouxu:froot-loops

Conversation

@jieyouxu

@jieyouxu jieyouxu commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

Mitigate #159429 by renaming #[unroll] => #[rustc_unroll].

Did not bother with a regression test, because a regression test would be hedging against an unknown attribute if #[unroll] later proceeds to get a different name.

Tracking issue for #![feature(loop_hints)]: #156874.

Rationale

Even while the crater-observed fallout seems to be relatively small, we'd like such nameres ambiguity breakages to be deliberate (read: T-lang FCP'd) rather than accidental (discovered through beta crater runs).

See discussions around last week's compiler triage meeting.

Background context

The recurring problem is that built-in attributes are treated differently compared to ordinary prelude attributes, built-in attributes, even while unstable, can name-collide with stable macro re-exports of the same name (and proc-macro helper attributes of the same name), which can break stable code. See #134964.

See also:

Prior Art

Alternatives to this PR

Generally:

  • We let it slide.
  • T-lang FCP on #[unroll] breakage (in which case this PR should be closed).
  • FCP another name (and associated breakages).
  • (Hard) Fix the built-in attribute name resolution behavior.

I have no particular preference on the approaches myself, any of this PR and the alternatives seem fine so as long as the breakage is deliberate not accidental.

@jieyouxu jieyouxu added the F-loop-hints `#![feature(loop_hints)]` label Jul 30, 2026
@rustbot

rustbot commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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 Jul 30, 2026
@rustbot

rustbot commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

r? @mati865

rustbot has assigned @mati865.
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 74 candidates
  • Random selection from 16 candidates

@jieyouxu jieyouxu added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 30, 2026
@jieyouxu

Copy link
Copy Markdown
Member Author

NB: nominated for T-lang in case they want to FCP-accept the breakage in #159429 (comment), but we should beta-backport this PR if T-lang doesn't make a call by the week before next stable.

@mati865

mati865 commented Jul 30, 2026

Copy link
Copy Markdown
Member

r=me if you want to workaround it ASAP, but IMO we can wait for nightly

As I said on Zulip, merging it for beta is reasonable to me.

@jieyouxu

Copy link
Copy Markdown
Member Author

r=me if you want to workaround it ASAP, but IMO we can wait for nightly

I will merge / time this around the week before next stable release week, approx. 2026-08-12 or 2026-08-13 ish. If T-lang makes no decision by then, I will merge this PR and tag this beta-accepted.

@jieyouxu jieyouxu added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 30, 2026
@rust-bors

This comment has been minimized.

Mitigation for [RUST-159429].

The recurring problem is that built-in attributes are treated
differently compared to ordinary prelude attributes, built-in
attributes, even while unstable, can name-collide with stable macro
re-exports of the same name (and proc-macro helper attributes of the
same name), which can break stable code. See [RUST-134964].

[RUST-159429]: rust-lang#159429
[RUST-134963]: rust-lang#134963
To account for the renamed `#[rustc_unroll]` attribute.
This stderr diff is a funny side-effect of renaming `#[unroll]` =>
`#[rustc_unroll]`, where the `#[rustc_unknown]` attribute name is just
similar enough edit distance wise to `#[rustc_unroll]` that
`#[rustc_unroll]` shows up as a plausible suggestion candidate, lol.
@rustbot

rustbot commented Aug 6, 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.

@jieyouxu

jieyouxu commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

Fixed trivial merge conflict, no changes.

Looks like lang consensus seems to be a rename mitigation at this moment based on comment and comment, so I will send this PR off to the queue and mark this beta-accepted, as discussed.

@bors r=mati865 rollup

@rust-bors

rust-bors Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d1265b7 has been approved by mati865

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 Aug 6, 2026
@rustbot

rustbot commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

beta backport approved as per compiler team on Zulip. A backport PR will be authored by the release team at the end of the current development cycle. Backport labels are handled by them.

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Aug 6, 2026
@Zalathar

Zalathar commented Aug 6, 2026

Copy link
Copy Markdown
Member

More prior art: There was a little bit of nameres ambiguity breakage reported when #[no_coverage] was renamed to #[coverage(off)] (still unstable)

As far as I can tell, no remedial action was taken in that case.

(via Zulip history)

jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 6, 2026
Rename `#[unroll]` => `#[rustc_unroll]` to mitigate nameres ambiguity

## Summary

Mitigate rust-lang#159429 by renaming `#[unroll]` => `#[rustc_unroll]`.

Did not bother with a regression test, because a regression test would be hedging against an unknown attribute if `#[unroll]` later proceeds to get a different name.

Tracking issue for `#![feature(loop_hints)]`: rust-lang#156874.

## Rationale

Even while the crater-observed fallout seems to be relatively small, we'd like such nameres ambiguity breakages to be *deliberate* (read: T-lang FCP'd) rather than accidental (discovered through beta crater runs).

See discussions around [last week's compiler triage meeting](https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202026-07-23/near/612371735).

## Background context

The recurring problem is that built-in attributes are treated differently compared to ordinary prelude attributes, built-in attributes, even while unstable, can name-collide with stable macro re-exports of the same name (and proc-macro helper attributes of the same name), which can break stable code. See rust-lang#134964.

See also:

- rust-lang#133708
- rust-lang#53913 (comment)
- https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Name.20Res.3A.20questions.20on.20intended.20behavior/near/562001319
- rust-lang#143834 (comment)

## Prior Art

- For `#[align]`, breakage was more wide-spread, so we posted this same mitigation here: rust-lang#144080.
- For `#[sanitize]`, T-lang explicitly FCP'd the breakage stemming from renaming `#[no_sanitize]` (old name) to `#[sanitize]` (new name) that regressed a couple of crates: rust-lang#142681 (comment).

## Alternatives to this PR

Generally:

- We let it slide.
- T-lang FCP on `#[unroll]` breakage (in which case this PR should be closed).
- FCP another name (and associated breakages).
- (Hard) Fix the built-in attribute name resolution behavior.

I have no particular preference on the approaches myself, any of this PR and the alternatives seem fine so as long as the breakage is *deliberate* not accidental.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
Rename `#[unroll]` => `#[rustc_unroll]` to mitigate nameres ambiguity

## Summary

Mitigate rust-lang#159429 by renaming `#[unroll]` => `#[rustc_unroll]`.

Did not bother with a regression test, because a regression test would be hedging against an unknown attribute if `#[unroll]` later proceeds to get a different name.

Tracking issue for `#![feature(loop_hints)]`: rust-lang#156874.

## Rationale

Even while the crater-observed fallout seems to be relatively small, we'd like such nameres ambiguity breakages to be *deliberate* (read: T-lang FCP'd) rather than accidental (discovered through beta crater runs).

See discussions around [last week's compiler triage meeting](https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202026-07-23/near/612371735).

## Background context

The recurring problem is that built-in attributes are treated differently compared to ordinary prelude attributes, built-in attributes, even while unstable, can name-collide with stable macro re-exports of the same name (and proc-macro helper attributes of the same name), which can break stable code. See rust-lang#134964.

See also:

- rust-lang#133708
- rust-lang#53913 (comment)
- https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Name.20Res.3A.20questions.20on.20intended.20behavior/near/562001319
- rust-lang#143834 (comment)

## Prior Art

- For `#[align]`, breakage was more wide-spread, so we posted this same mitigation here: rust-lang#144080.
- For `#[sanitize]`, T-lang explicitly FCP'd the breakage stemming from renaming `#[no_sanitize]` (old name) to `#[sanitize]` (new name) that regressed a couple of crates: rust-lang#142681 (comment).

## Alternatives to this PR

Generally:

- We let it slide.
- T-lang FCP on `#[unroll]` breakage (in which case this PR should be closed).
- FCP another name (and associated breakages).
- (Hard) Fix the built-in attribute name resolution behavior.

I have no particular preference on the approaches myself, any of this PR and the alternatives seem fine so as long as the breakage is *deliberate* not accidental.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
Rename `#[unroll]` => `#[rustc_unroll]` to mitigate nameres ambiguity

## Summary

Mitigate rust-lang#159429 by renaming `#[unroll]` => `#[rustc_unroll]`.

Did not bother with a regression test, because a regression test would be hedging against an unknown attribute if `#[unroll]` later proceeds to get a different name.

Tracking issue for `#![feature(loop_hints)]`: rust-lang#156874.

## Rationale

Even while the crater-observed fallout seems to be relatively small, we'd like such nameres ambiguity breakages to be *deliberate* (read: T-lang FCP'd) rather than accidental (discovered through beta crater runs).

See discussions around [last week's compiler triage meeting](https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202026-07-23/near/612371735).

## Background context

The recurring problem is that built-in attributes are treated differently compared to ordinary prelude attributes, built-in attributes, even while unstable, can name-collide with stable macro re-exports of the same name (and proc-macro helper attributes of the same name), which can break stable code. See rust-lang#134964.

See also:

- rust-lang#133708
- rust-lang#53913 (comment)
- https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Name.20Res.3A.20questions.20on.20intended.20behavior/near/562001319
- rust-lang#143834 (comment)

## Prior Art

- For `#[align]`, breakage was more wide-spread, so we posted this same mitigation here: rust-lang#144080.
- For `#[sanitize]`, T-lang explicitly FCP'd the breakage stemming from renaming `#[no_sanitize]` (old name) to `#[sanitize]` (new name) that regressed a couple of crates: rust-lang#142681 (comment).

## Alternatives to this PR

Generally:

- We let it slide.
- T-lang FCP on `#[unroll]` breakage (in which case this PR should be closed).
- FCP another name (and associated breakages).
- (Hard) Fix the built-in attribute name resolution behavior.

I have no particular preference on the approaches myself, any of this PR and the alternatives seem fine so as long as the breakage is *deliberate* not accidental.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
Rename `#[unroll]` => `#[rustc_unroll]` to mitigate nameres ambiguity

## Summary

Mitigate rust-lang#159429 by renaming `#[unroll]` => `#[rustc_unroll]`.

Did not bother with a regression test, because a regression test would be hedging against an unknown attribute if `#[unroll]` later proceeds to get a different name.

Tracking issue for `#![feature(loop_hints)]`: rust-lang#156874.

## Rationale

Even while the crater-observed fallout seems to be relatively small, we'd like such nameres ambiguity breakages to be *deliberate* (read: T-lang FCP'd) rather than accidental (discovered through beta crater runs).

See discussions around [last week's compiler triage meeting](https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202026-07-23/near/612371735).

## Background context

The recurring problem is that built-in attributes are treated differently compared to ordinary prelude attributes, built-in attributes, even while unstable, can name-collide with stable macro re-exports of the same name (and proc-macro helper attributes of the same name), which can break stable code. See rust-lang#134964.

See also:

- rust-lang#133708
- rust-lang#53913 (comment)
- https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Name.20Res.3A.20questions.20on.20intended.20behavior/near/562001319
- rust-lang#143834 (comment)

## Prior Art

- For `#[align]`, breakage was more wide-spread, so we posted this same mitigation here: rust-lang#144080.
- For `#[sanitize]`, T-lang explicitly FCP'd the breakage stemming from renaming `#[no_sanitize]` (old name) to `#[sanitize]` (new name) that regressed a couple of crates: rust-lang#142681 (comment).

## Alternatives to this PR

Generally:

- We let it slide.
- T-lang FCP on `#[unroll]` breakage (in which case this PR should be closed).
- FCP another name (and associated breakages).
- (Hard) Fix the built-in attribute name resolution behavior.

I have no particular preference on the approaches myself, any of this PR and the alternatives seem fine so as long as the breakage is *deliberate* not accidental.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
Rename `#[unroll]` => `#[rustc_unroll]` to mitigate nameres ambiguity

## Summary

Mitigate rust-lang#159429 by renaming `#[unroll]` => `#[rustc_unroll]`.

Did not bother with a regression test, because a regression test would be hedging against an unknown attribute if `#[unroll]` later proceeds to get a different name.

Tracking issue for `#![feature(loop_hints)]`: rust-lang#156874.

## Rationale

Even while the crater-observed fallout seems to be relatively small, we'd like such nameres ambiguity breakages to be *deliberate* (read: T-lang FCP'd) rather than accidental (discovered through beta crater runs).

See discussions around [last week's compiler triage meeting](https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202026-07-23/near/612371735).

## Background context

The recurring problem is that built-in attributes are treated differently compared to ordinary prelude attributes, built-in attributes, even while unstable, can name-collide with stable macro re-exports of the same name (and proc-macro helper attributes of the same name), which can break stable code. See rust-lang#134964.

See also:

- rust-lang#133708
- rust-lang#53913 (comment)
- https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Name.20Res.3A.20questions.20on.20intended.20behavior/near/562001319
- rust-lang#143834 (comment)

## Prior Art

- For `#[align]`, breakage was more wide-spread, so we posted this same mitigation here: rust-lang#144080.
- For `#[sanitize]`, T-lang explicitly FCP'd the breakage stemming from renaming `#[no_sanitize]` (old name) to `#[sanitize]` (new name) that regressed a couple of crates: rust-lang#142681 (comment).

## Alternatives to this PR

Generally:

- We let it slide.
- T-lang FCP on `#[unroll]` breakage (in which case this PR should be closed).
- FCP another name (and associated breakages).
- (Hard) Fix the built-in attribute name resolution behavior.

I have no particular preference on the approaches myself, any of this PR and the alternatives seem fine so as long as the breakage is *deliberate* not accidental.
rust-bors Bot pushed a commit that referenced this pull request Aug 6, 2026
…uwer

Rollup of 17 pull requests

Successful merges:

 - #159530 (Cap socket send length to c_int::MAX on Apple targets)
 - #159506 (Allow associated const equality constraints with GCA)
 - #160006 (Account for desugaring in method call move errors)
 - #160415 (Split `aarch64-apple{,-macos-26}` => `aarch64-apple{,-macos-26}-{1,2}` jobs)
 - #160464 (fix: Check the fallback map before queueing child in `visible_parent_map` breadth-first search)
 - #160555 (Split `apply_primary_terminator_effect`)
 - #160592 (Suggest if-let chain continuation on unclosed delimiter)
 - #160600 (Avoid the std DLL copy alongside rustc)
 - #160156 (check_consts: exhaustively match on CastKind)
 - #160211 (Rename `#[unroll]` => `#[rustc_unroll]` to mitigate nameres ambiguity)
 - #160304 (Add tests for fixed new solver issues)
 - #160398 (rustc_abi: Add `LayoutData::is_variant_uninhabited` method)
 - #160546 (Update error message in documentation comments)
 - #160568 (Use `VisitorResult` helper macros)
 - #160571 (Add regression test for array type recovery in generic arguments)
 - #160588 (add a test showing polonius alpha is not a subset of datalog polonius)
 - #160617 (Add a suggestion to MissingUnsafeOnExtern diagnostic)
@rust-bors
rust-bors Bot merged commit 25fd483 into rust-lang:main Aug 6, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Aug 6, 2026
rust-timer added a commit that referenced this pull request Aug 6, 2026
Rollup merge of #160211 - jieyouxu:froot-loops, r=mati865

Rename `#[unroll]` => `#[rustc_unroll]` to mitigate nameres ambiguity

## Summary

Mitigate #159429 by renaming `#[unroll]` => `#[rustc_unroll]`.

Did not bother with a regression test, because a regression test would be hedging against an unknown attribute if `#[unroll]` later proceeds to get a different name.

Tracking issue for `#![feature(loop_hints)]`: #156874.

## Rationale

Even while the crater-observed fallout seems to be relatively small, we'd like such nameres ambiguity breakages to be *deliberate* (read: T-lang FCP'd) rather than accidental (discovered through beta crater runs).

See discussions around [last week's compiler triage meeting](https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202026-07-23/near/612371735).

## Background context

The recurring problem is that built-in attributes are treated differently compared to ordinary prelude attributes, built-in attributes, even while unstable, can name-collide with stable macro re-exports of the same name (and proc-macro helper attributes of the same name), which can break stable code. See #134964.

See also:

- #133708
- #53913 (comment)
- https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Name.20Res.3A.20questions.20on.20intended.20behavior/near/562001319
- #143834 (comment)

## Prior Art

- For `#[align]`, breakage was more wide-spread, so we posted this same mitigation here: #144080.
- For `#[sanitize]`, T-lang explicitly FCP'd the breakage stemming from renaming `#[no_sanitize]` (old name) to `#[sanitize]` (new name) that regressed a couple of crates: #142681 (comment).

## Alternatives to this PR

Generally:

- We let it slide.
- T-lang FCP on `#[unroll]` breakage (in which case this PR should be closed).
- FCP another name (and associated breakages).
- (Hard) Fix the built-in attribute name resolution behavior.

I have no particular preference on the approaches myself, any of this PR and the alternatives seem fine so as long as the breakage is *deliberate* not accidental.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) beta-accepted Accepted for backporting to the compiler in the beta channel. beta-nominated Nominated for backporting to the compiler in the beta channel. F-loop-hints `#![feature(loop_hints)]` 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