about summary refs log tree commit diff
path: root/compiler/rustc_passes/messages.ftl
diff options
context:
space:
mode:
authorJieyou Xu <jieyouxu@outlook.com>2025-07-18 00:10:46 +0800
committerJieyou Xu <jieyouxu@outlook.com>2025-07-19 01:42:30 +0800
commit69b71e44107b4905ec7ad84ccb3edf4f14b3df69 (patch)
treefa801205d444880c9972c2701eef39bafc453b08 /compiler/rustc_passes/messages.ftl
parentb2e94bf020a99473cf80f05f410af8a5cfc486a6 (diff)
downloadrust-69b71e44107b4905ec7ad84ccb3edf4f14b3df69.tar.gz
rust-69b71e44107b4905ec7ad84ccb3edf4f14b3df69.zip
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.
Diffstat (limited to 'compiler/rustc_passes/messages.ftl')
-rw-r--r--compiler/rustc_passes/messages.ftl6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl
index d1b856ca415..f5375f23541 100644
--- a/compiler/rustc_passes/messages.ftl
+++ b/compiler/rustc_passes/messages.ftl
@@ -14,7 +14,7 @@ passes_abi_of =
     fn_abi_of({$fn_name}) = {$fn_abi}
 
 passes_align_attr_application =
-    `#[align(...)]` should be applied to a function item
+    `#[rustc_align(...)]` should be applied to a function item
     .label = not a function item
 
 passes_align_on_fields =
@@ -22,7 +22,7 @@ passes_align_on_fields =
     .warn = {-passes_previously_accepted}
 
 passes_align_should_be_repr_align =
-    `#[align(...)]` is not supported on {$item} items
+    `#[rustc_align(...)]` is not supported on {$item} items
     .suggestion = use `#[repr(align(...))]` instead
 
 passes_allow_incoherent_impl =
@@ -604,7 +604,7 @@ passes_repr_align_greater_than_target_max =
 
 passes_repr_align_should_be_align =
     `#[repr(align(...))]` is not supported on {$item} items
-    .help = use `#[align(...)]` instead
+    .help = use `#[rustc_align(...)]` instead
 
 passes_repr_conflicting =
     conflicting representation hints