From 69b71e44107b4905ec7ad84ccb3edf4f14b3df69 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 18 Jul 2025 00:10:46 +0800 Subject: 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 where mitigation options were considered. --- compiler/rustc_parse/src/validate_attr.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_parse') diff --git a/compiler/rustc_parse/src/validate_attr.rs b/compiler/rustc_parse/src/validate_attr.rs index a476f0db37e..cca621103b5 100644 --- a/compiler/rustc_parse/src/validate_attr.rs +++ b/compiler/rustc_parse/src/validate_attr.rs @@ -294,7 +294,9 @@ pub fn check_builtin_meta_item( | sym::rustc_paren_sugar | sym::type_const | sym::repr - | sym::align + // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres + // ambiguity + | sym::rustc_align | sym::deprecated | sym::optimize | sym::pointee -- cgit 1.4.1-3-g733a5