Skip to content

Commit 7ad5be7

Browse files
committed
Mitigate #[align] name resolution ambiguity regression with a rename
From `#[align]` -> `#[rustc_align]`. Attributes starting with `rustc` are always perma-unstable and feature-gated by `feature(rustc_attrs)`. See regression RUST-143834. For the underlying problem where even introducing new feature-gated unstable built-in attributes can break user code such as ```rs macro_rules! align { () => { /* .. */ }; } pub(crate) use align; // `use` here becomes ambiguous ``` refer to RUST-134963. Since the `#[align]` attribute is still feature-gated by `feature(fn_align)`, we can rename it as a mitigation. Note that `#[rustc_align]` will obviously mean that current unstable user code using `feature(fn_aling)` will need additionally `feature(rustc_attrs)`, but this is a short-term mitigation to buy time, and is expected to be changed to a better name with less collision potential. See <https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202025-07-17/near/529290371> where mitigation options were considered.
1 parent c0dcba2 commit 7ad5be7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/pass/fn_align.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
//@compile-flags: -Zmin-function-alignment=8
2+
3+
// FIXME(rust-lang/rust#82232, rust-lang/rust#143834): temporarily renamed to mitigate `#[align]`
4+
// nameres ambiguity
5+
#![feature(rustc_attrs)]
26
#![feature(fn_align)]
37

48
// When a function uses `align(N)`, the function address should be a multiple of `N`.
59

6-
#[align(256)]
10+
#[rustc_align(256)]
711
fn foo() {}
812

9-
#[align(16)]
13+
#[rustc_align(16)]
1014
fn bar() {}
1115

12-
#[align(4)]
16+
#[rustc_align(4)]
1317
fn baz() {}
1418

1519
fn main() {

0 commit comments

Comments
 (0)