summary refs log tree commit diff
path: root/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs
diff options
context:
space:
mode:
authorJieyou Xu <jieyouxu@outlook.com>2025-07-18 00:10:46 +0800
committerJosh Stone <jistone@redhat.com>2025-07-24 11:02:01 -0700
commit2e832047c6bf348ba44fd57b21bada846d62f156 (patch)
tree2239e5eb288c561ba48135ba5ed537b743b51e9d /tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs
parent43056c1614241ed06597a79b5e8f6464e6c8e11d (diff)
downloadrust-2e832047c6bf348ba44fd57b21bada846d62f156.tar.gz
rust-2e832047c6bf348ba44fd57b21bada846d62f156.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.

(cherry picked from commit 69b71e44107b4905ec7ad84ccb3edf4f14b3df69)
Diffstat (limited to 'tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs')
-rw-r--r--tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs b/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs
index 5629f92c468..536d6ff43fb 100644
--- a/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs
+++ b/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs
@@ -1,21 +1,19 @@
-//~ NOTE `align` could refer to a built-in attribute
-
 // Anti-regression test to demonstrate that at least we mitigated breakage from adding a new
 // `#[align]` built-in attribute.
+//
+// See https://github.com/rust-lang/rust/issues/143834.
+
+//@ check-pass
 
 // Needs edition >= 2018 macro use behavior.
 //@ edition: 2018
 
 macro_rules! align {
-    //~^ NOTE `align` could also refer to the macro defined here
     () => {
         /* .. */
     };
 }
 
 pub(crate) use align;
-//~^ ERROR `align` is ambiguous
-//~| NOTE ambiguous name
-//~| NOTE ambiguous because of a name conflict with a builtin attribute
 
 fn main() {}