mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-03 09:32:42 +00:00
Rename `#[unroll]` => `#[rustc_unroll]` to mitigate nameres ambiguity ## Summary Mitigate rust-lang/rust#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/rust#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/rust#134964. See also: - https://github.com/rust-lang/rust/issues/133708 - https://github.com/rust-lang/rust/pull/53913#issuecomment-418204136 - https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Name.20Res.3A.20questions.20on.20intended.20behavior/near/562001319 - https://github.com/rust-lang/rust/issues/143834#issuecomment-3084415277 ## Prior Art - For `#[align]`, breakage was more wide-spread, so we posted this same mitigation here: https://github.com/rust-lang/rust/pull/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: https://github.com/rust-lang/rust/pull/142681#issuecomment-3115226820. ## 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.