Skip to content

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

Open
jieyouxu wants to merge 5 commits into
rust-lang:mainfrom
jieyouxu:froot-loops
Open

Rename #[unroll] => #[rustc_unroll] to mitigate nameres ambiguity#160211
jieyouxu wants to merge 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).
  • (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 added 5 commits July 30, 2026 19:13
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.
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) beta-nominated Nominated for backporting to the compiler in the beta channel. F-loop-hints `#![feature(loop_hints)]` S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

3 participants