about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-07-22 00:54:28 +0800
committerGitHub <noreply@github.com>2025-07-22 00:54:28 +0800
commitef4a7fb1b7f398565a038c1eb84da30e53006599 (patch)
tree19d7cd9d685c3f155e673b64f2ce26315ba35758
parenta3ab8076941c3711edbdc54db13652850f3476ae (diff)
parent69b71e44107b4905ec7ad84ccb3edf4f14b3df69 (diff)
downloadrust-ef4a7fb1b7f398565a038c1eb84da30e53006599.tar.gz
rust-ef4a7fb1b7f398565a038c1eb84da30e53006599.zip
Rollup merge of #144080 - jieyouxu:realign, r=BoxyUwU
Mitigate `#[align]` name resolution ambiguity regression with a rename

Mitigates beta regression rust-lang/rust#143834 after a beta backport.

### Background on the beta regression

The name resolution regression arises due to rust-lang/rust#142507 adding a new feature-gated built-in attribute named `#[align]`. However, unfortunately even [introducing new feature-gated unstable built-in attributes can break user code](https://www.github.com/rust-lang/rust/issues/134963) such as

```rs
macro_rules! align {
    () => {
        /* .. */
    };
}

pub(crate) use align; // `use` here becomes ambiguous
```

### Mitigation approach

This PR renames `#[align]` to `#[rustc_align]` to mitigate the beta regression by:

1. Undoing the introduction of a new built-in attribute with a common name, i.e. `#[align]`.
2. Renaming `#[align]` to `#[rustc_align]`. The renamed attribute being `rustc_align` will not introduce new stable breakages, as attributes beginning with `rustc` are reserved and perma-unstable. This does mean existing nightly code using `fn_align` feature will additionally need to specify `#![feature(rustc_attrs)]`.

This PR is very much a short-term mitigation to alleviate time pressure from having to fully fix the current limitation of inevitable name resolution regressions that would arise from adding any built-in attributes. Long-term solutions are discussed in [#t-lang > namespacing macro attrs to reduce conflicts with new adds](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/namespacing.20macro.20attrs.20to.20reduce.20conflicts.20with.20new.20adds/with/529249622).

### Alternative mitigation options

[Various mitigation options were considered during the compiler triage meeting](https://github.com/rust-lang/rust/issues/143834#issuecomment-3084415277), and those consideration are partly reproduced here:

- Reverting the PR doesn't seem very minimal/trivial, and carries risks of its own.
- Rename to a less-common but aim-to-stabilization name is itself not safe nor convenient, because (1) that risks introducing new regressions (i.e. ambiguity against the new name), and (2) lang would have to FCP the new name hastily for the mitigation to land timely and have a chance to be backported. This also makes the path towards stabilization annoying.
- Rename the attribute to a rustc attribute, which will be perma-unstable and does not cause new ambiguities in stable code.
    - This alleviates the time pressure to address *this* regression, or for lang to have to rush an FCP for some new name that can still break user code.
    - This avoids backing out a whole implementation.

### Review advice

This PR is best reviewed commit-by-commit.

- Commit 1 adds a test `tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs` which demonstrates the current name resolution regression re. `align`. This test fails against current master.
- Commit 2 carries out the renames and test reblesses. Notably, commit 2 will cause `tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs` to change from fail (nameres regression) to pass.

This PR, if the approach still seems acceptable, will need a beta-backport to address the beta regression.
-rw-r--r--compiler/rustc_attr_data_structures/src/attributes.rs1
-rw-r--r--compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs3
-rw-r--r--compiler/rustc_attr_parsing/src/attributes/repr.rs2
-rw-r--r--compiler/rustc_feature/src/builtin_attrs.rs3
-rw-r--r--compiler/rustc_middle/src/middle/codegen_fn_attrs.rs1
-rw-r--r--compiler/rustc_parse/src/validate_attr.rs4
-rw-r--r--compiler/rustc_passes/messages.ftl6
-rw-r--r--compiler/rustc_passes/src/check_attr.rs1
-rw-r--r--compiler/rustc_span/src/symbol.rs2
-rw-r--r--src/tools/miri/tests/pass/fn_align.rs10
-rw-r--r--tests/codegen/align-fn.rs54
-rw-r--r--tests/codegen/min-function-alignment.rs6
-rw-r--r--tests/codegen/naked-fn/aligned.rs5
-rw-r--r--tests/codegen/naked-fn/min-function-alignment.rs6
-rw-r--r--tests/ui/asm/naked-with-invalid-repr-attr.rs6
-rw-r--r--tests/ui/asm/naked-with-invalid-repr-attr.stderr12
-rw-r--r--tests/ui/attributes/fn-align-dyn.rs7
-rw-r--r--tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs19
-rw-r--r--tests/ui/attributes/malformed-attrs.rs3
-rw-r--r--tests/ui/attributes/malformed-attrs.stderr170
-rw-r--r--tests/ui/attributes/malformed-fn-align.rs35
-rw-r--r--tests/ui/attributes/malformed-fn-align.stderr116
-rw-r--r--tests/ui/feature-gates/feature-gate-fn_align.rs14
-rw-r--r--tests/ui/feature-gates/feature-gate-fn_align.stderr26
24 files changed, 285 insertions, 227 deletions
diff --git a/compiler/rustc_attr_data_structures/src/attributes.rs b/compiler/rustc_attr_data_structures/src/attributes.rs
index 3157b18b635..9f99b33adcc 100644
--- a/compiler/rustc_attr_data_structures/src/attributes.rs
+++ b/compiler/rustc_attr_data_structures/src/attributes.rs
@@ -234,6 +234,7 @@ pub enum CfgEntry {
 pub enum AttributeKind {
     // tidy-alphabetical-start
     /// Represents `#[align(N)]`.
+    // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
     Align { align: Align, span: Span },
 
     /// Represents `#[rustc_allow_const_fn_unstable]`.
diff --git a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
index 3e542771d58..bb28121c2c5 100644
--- a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
@@ -177,7 +177,8 @@ impl<S: Stage> AttributeParser<S> for NakedParser {
             sym::instruction_set,
             sym::repr,
             sym::rustc_std_internal_symbol,
-            sym::align,
+            // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
+            sym::rustc_align,
             // obviously compatible with self
             sym::naked,
             // documentation
diff --git a/compiler/rustc_attr_parsing/src/attributes/repr.rs b/compiler/rustc_attr_parsing/src/attributes/repr.rs
index 6a45832ed7f..521acbb607c 100644
--- a/compiler/rustc_attr_parsing/src/attributes/repr.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/repr.rs
@@ -274,7 +274,7 @@ fn parse_alignment(node: &LitKind) -> Result<Align, &'static str> {
 pub(crate) struct AlignParser(Option<(Align, Span)>);
 
 impl AlignParser {
-    const PATH: &'static [Symbol] = &[sym::align];
+    const PATH: &'static [Symbol] = &[sym::rustc_align];
     const TEMPLATE: AttributeTemplate = template!(List: "<alignment in bytes>");
 
     fn parse<'c, S: Stage>(
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
index 74872504b79..96df6aa19bc 100644
--- a/compiler/rustc_feature/src/builtin_attrs.rs
+++ b/compiler/rustc_feature/src/builtin_attrs.rs
@@ -490,7 +490,8 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
     ),
     ungated!(no_link, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
     ungated!(repr, Normal, template!(List: "C"), DuplicatesOk, EncodeCrossCrate::No),
-    gated!(align, Normal, template!(List: "alignment"), DuplicatesOk, EncodeCrossCrate::No, fn_align, experimental!(align)),
+    // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
+    gated!(rustc_align, Normal, template!(List: "alignment"), DuplicatesOk, EncodeCrossCrate::No, fn_align, experimental!(rustc_align)),
     ungated!(unsafe(Edition2024) export_name, Normal, template!(NameValueStr: "name"), FutureWarnPreceding, EncodeCrossCrate::No),
     ungated!(unsafe(Edition2024) link_section, Normal, template!(NameValueStr: "name"), FutureWarnPreceding, EncodeCrossCrate::No),
     ungated!(unsafe(Edition2024) no_mangle, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
diff --git a/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs b/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs
index 6eae3b51e29..34a29acdc85 100644
--- a/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs
+++ b/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs
@@ -70,6 +70,7 @@ pub struct CodegenFnAttrs {
     /// switching between multiple instruction sets.
     pub instruction_set: Option<InstructionSetAttr>,
     /// The `#[align(...)]` attribute. Determines the alignment of the function body.
+    // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
     pub alignment: Option<Align>,
     /// The `#[patchable_function_entry(...)]` attribute. Indicates how many nops should be around
     /// the function entry.
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
diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl
index 51e23edb9bb..6a28fe2617e 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 =
@@ -605,7 +605,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
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 3ec6a1124a6..96c895e71df 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -1970,6 +1970,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
     }
 
     /// Checks if the `#[align]` attributes on `item` are valid.
+    // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
     fn check_align(
         &self,
         span: Span,
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index d28a73bc139..762126a4aaa 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -1809,6 +1809,8 @@ symbols! {
         rust_out,
         rustc,
         rustc_abi,
+        // FIXME(#82232, #143834): temporary name to mitigate `#[align]` nameres ambiguity
+        rustc_align,
         rustc_allocator,
         rustc_allocator_zeroed,
         rustc_allow_const_fn_unstable,
diff --git a/src/tools/miri/tests/pass/fn_align.rs b/src/tools/miri/tests/pass/fn_align.rs
index 28f92995880..9752d033458 100644
--- a/src/tools/miri/tests/pass/fn_align.rs
+++ b/src/tools/miri/tests/pass/fn_align.rs
@@ -1,15 +1,19 @@
 //@compile-flags: -Zmin-function-alignment=8
+
+// FIXME(rust-lang/rust#82232, rust-lang/rust#143834): temporarily renamed to mitigate `#[align]`
+// nameres ambiguity
+#![feature(rustc_attrs)]
 #![feature(fn_align)]
 
 // When a function uses `align(N)`, the function address should be a multiple of `N`.
 
-#[align(256)]
+#[rustc_align(256)]
 fn foo() {}
 
-#[align(16)]
+#[rustc_align(16)]
 fn bar() {}
 
-#[align(4)]
+#[rustc_align(4)]
 fn baz() {}
 
 fn main() {
diff --git a/tests/codegen/align-fn.rs b/tests/codegen/align-fn.rs
index fd572910c28..cbc24e2ae2e 100644
--- a/tests/codegen/align-fn.rs
+++ b/tests/codegen/align-fn.rs
@@ -3,11 +3,13 @@
 //@ ignore-wasm32 aligning functions is not currently supported on wasm (#143368)
 
 #![crate_type = "lib"]
+// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
+#![feature(rustc_attrs)]
 #![feature(fn_align)]
 
 // CHECK: align 16
 #[unsafe(no_mangle)]
-#[align(16)]
+#[rustc_align(16)]
 pub fn fn_align() {}
 
 pub struct A;
@@ -15,12 +17,12 @@ pub struct A;
 impl A {
     // CHECK: align 16
     #[unsafe(no_mangle)]
-    #[align(16)]
+    #[rustc_align(16)]
     pub fn method_align(self) {}
 
     // CHECK: align 16
     #[unsafe(no_mangle)]
-    #[align(16)]
+    #[rustc_align(16)]
     pub fn associated_fn() {}
 }
 
@@ -29,18 +31,18 @@ trait T: Sized {
 
     fn trait_method(self) {}
 
-    #[align(8)]
+    #[rustc_align(8)]
     fn trait_method_inherit_low(self);
 
-    #[align(32)]
+    #[rustc_align(32)]
     fn trait_method_inherit_high(self);
 
-    #[align(32)]
+    #[rustc_align(32)]
     fn trait_method_inherit_default(self) {}
 
-    #[align(4)]
-    #[align(128)]
-    #[align(8)]
+    #[rustc_align(4)]
+    #[rustc_align(128)]
+    #[rustc_align(8)]
     fn inherit_highest(self) {}
 }
 
@@ -48,27 +50,27 @@ impl T for A {
     // CHECK-LABEL: trait_fn
     // CHECK-SAME: align 16
     #[unsafe(no_mangle)]
-    #[align(16)]
+    #[rustc_align(16)]
     fn trait_fn() {}
 
     // CHECK-LABEL: trait_method
     // CHECK-SAME: align 16
     #[unsafe(no_mangle)]
-    #[align(16)]
+    #[rustc_align(16)]
     fn trait_method(self) {}
 
     // The prototype's align is ignored because the align here is higher.
     // CHECK-LABEL: trait_method_inherit_low
     // CHECK-SAME: align 16
     #[unsafe(no_mangle)]
-    #[align(16)]
+    #[rustc_align(16)]
     fn trait_method_inherit_low(self) {}
 
     // The prototype's align is used because it is higher.
     // CHECK-LABEL: trait_method_inherit_high
     // CHECK-SAME: align 32
     #[unsafe(no_mangle)]
-    #[align(16)]
+    #[rustc_align(16)]
     fn trait_method_inherit_high(self) {}
 
     // The prototype's align inherited.
@@ -81,8 +83,8 @@ impl T for A {
     // CHECK-LABEL: inherit_highest
     // CHECK-SAME: align 128
     #[unsafe(no_mangle)]
-    #[align(32)]
-    #[align(64)]
+    #[rustc_align(32)]
+    #[rustc_align(64)]
     fn inherit_highest(self) {}
 }
 
@@ -90,7 +92,7 @@ trait HasDefaultImpl: Sized {
     // CHECK-LABEL: inherit_from_default_method
     // CHECK-LABEL: inherit_from_default_method
     // CHECK-SAME: align 32
-    #[align(32)]
+    #[rustc_align(32)]
     fn inherit_from_default_method(self) {}
 }
 
@@ -101,35 +103,35 @@ impl HasDefaultImpl for InstantiateDefaultMethods {}
 // CHECK-LABEL: align_specified_twice_1
 // CHECK-SAME: align 64
 #[unsafe(no_mangle)]
-#[align(32)]
-#[align(64)]
+#[rustc_align(32)]
+#[rustc_align(64)]
 pub fn align_specified_twice_1() {}
 
 // CHECK-LABEL: align_specified_twice_2
 // CHECK-SAME: align 128
 #[unsafe(no_mangle)]
-#[align(128)]
-#[align(32)]
+#[rustc_align(128)]
+#[rustc_align(32)]
 pub fn align_specified_twice_2() {}
 
 // CHECK-LABEL: align_specified_twice_3
 // CHECK-SAME: align 256
 #[unsafe(no_mangle)]
-#[align(32)]
-#[align(256)]
+#[rustc_align(32)]
+#[rustc_align(256)]
 pub fn align_specified_twice_3() {}
 
 const _: () = {
     // CHECK-LABEL: align_unmangled
     // CHECK-SAME: align 256
     #[unsafe(no_mangle)]
-    #[align(32)]
-    #[align(256)]
+    #[rustc_align(32)]
+    #[rustc_align(256)]
     extern "C" fn align_unmangled() {}
 };
 
 unsafe extern "C" {
-    #[align(256)]
+    #[rustc_align(256)]
     fn align_unmangled();
 }
 
@@ -137,5 +139,5 @@ unsafe extern "C" {
 // CHECK-LABEL: async_align
 // CHECK-SAME: align 64
 #[unsafe(no_mangle)]
-#[align(64)]
+#[rustc_align(64)]
 pub async fn async_align() {}
diff --git a/tests/codegen/min-function-alignment.rs b/tests/codegen/min-function-alignment.rs
index 6a3843b0f4f..ea5f957e81f 100644
--- a/tests/codegen/min-function-alignment.rs
+++ b/tests/codegen/min-function-alignment.rs
@@ -5,6 +5,8 @@
 //@ ignore-wasm32 aligning functions is not currently supported on wasm (#143368)
 
 #![crate_type = "lib"]
+// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
+#![feature(rustc_attrs)]
 #![feature(fn_align)]
 
 // Functions without explicit alignment use the global minimum.
@@ -21,7 +23,7 @@ pub fn no_explicit_align() {}
 // align16: align 16
 // align1024: align 1024
 #[no_mangle]
-#[align(8)]
+#[rustc_align(8)]
 pub fn lower_align() {}
 
 // the higher value of min-function-alignment and the align attribute wins out
@@ -30,7 +32,7 @@ pub fn lower_align() {}
 // align16: align 32
 // align1024: align 1024
 #[no_mangle]
-#[align(32)]
+#[rustc_align(32)]
 pub fn higher_align() {}
 
 // cold functions follow the same rules as other functions
diff --git a/tests/codegen/naked-fn/aligned.rs b/tests/codegen/naked-fn/aligned.rs
index 2648b0213ca..d7281c4219a 100644
--- a/tests/codegen/naked-fn/aligned.rs
+++ b/tests/codegen/naked-fn/aligned.rs
@@ -4,12 +4,15 @@
 //@ ignore-wasm32 aligning functions is not currently supported on wasm (#143368)
 
 #![crate_type = "lib"]
+// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
+#![feature(rustc_attrs)]
 #![feature(fn_align)]
+
 use std::arch::naked_asm;
 
 // CHECK: .balign 16
 // CHECK-LABEL: naked_empty:
-#[align(16)]
+#[rustc_align(16)]
 #[no_mangle]
 #[unsafe(naked)]
 pub extern "C" fn naked_empty() {
diff --git a/tests/codegen/naked-fn/min-function-alignment.rs b/tests/codegen/naked-fn/min-function-alignment.rs
index 4ebaacd3eff..406e9334fa5 100644
--- a/tests/codegen/naked-fn/min-function-alignment.rs
+++ b/tests/codegen/naked-fn/min-function-alignment.rs
@@ -3,6 +3,8 @@
 //@ ignore-arm no "ret" mnemonic
 //@ ignore-wasm32 aligning functions is not currently supported on wasm (#143368)
 
+// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
+#![feature(rustc_attrs)]
 #![feature(fn_align)]
 #![crate_type = "lib"]
 
@@ -17,7 +19,7 @@ pub extern "C" fn naked_no_explicit_align() {
 
 // CHECK: .balign 16
 #[no_mangle]
-#[align(8)]
+#[rustc_align(8)]
 #[unsafe(naked)]
 pub extern "C" fn naked_lower_align() {
     core::arch::naked_asm!("ret")
@@ -25,7 +27,7 @@ pub extern "C" fn naked_lower_align() {
 
 // CHECK: .balign 32
 #[no_mangle]
-#[align(32)]
+#[rustc_align(32)]
 #[unsafe(naked)]
 pub extern "C" fn naked_higher_align() {
     core::arch::naked_asm!("ret")
diff --git a/tests/ui/asm/naked-with-invalid-repr-attr.rs b/tests/ui/asm/naked-with-invalid-repr-attr.rs
index bfbbf29a69e..4620d007e4e 100644
--- a/tests/ui/asm/naked-with-invalid-repr-attr.rs
+++ b/tests/ui/asm/naked-with-invalid-repr-attr.rs
@@ -1,5 +1,9 @@
 //@ needs-asm-support
+
+// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
+#![feature(rustc_attrs)]
 #![feature(fn_align)]
+
 #![crate_type = "lib"]
 use std::arch::naked_asm;
 
@@ -21,7 +25,7 @@ extern "C" fn example2() {
 
 #[repr(C)]
 //~^ ERROR attribute should be applied to a struct, enum, or union [E0517]
-#[align(16)]
+#[rustc_align(16)]
 #[unsafe(naked)]
 extern "C" fn example3() {
     //~^ NOTE not a struct, enum, or union
diff --git a/tests/ui/asm/naked-with-invalid-repr-attr.stderr b/tests/ui/asm/naked-with-invalid-repr-attr.stderr
index 4eb4a4e5a04..8530495be66 100644
--- a/tests/ui/asm/naked-with-invalid-repr-attr.stderr
+++ b/tests/ui/asm/naked-with-invalid-repr-attr.stderr
@@ -1,5 +1,5 @@
 error[E0517]: attribute should be applied to a struct, enum, or union
-  --> $DIR/naked-with-invalid-repr-attr.rs:6:8
+  --> $DIR/naked-with-invalid-repr-attr.rs:10:8
    |
 LL |   #[repr(C)]
    |          ^
@@ -11,7 +11,7 @@ LL | | }
    | |_- not a struct, enum, or union
 
 error[E0517]: attribute should be applied to a struct, enum, or union
-  --> $DIR/naked-with-invalid-repr-attr.rs:14:8
+  --> $DIR/naked-with-invalid-repr-attr.rs:18:8
    |
 LL |   #[repr(transparent)]
    |          ^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL | | }
    | |_- not a struct, enum, or union
 
 error[E0517]: attribute should be applied to a struct, enum, or union
-  --> $DIR/naked-with-invalid-repr-attr.rs:22:8
+  --> $DIR/naked-with-invalid-repr-attr.rs:26:8
    |
 LL |   #[repr(C)]
    |          ^
@@ -35,7 +35,7 @@ LL | | }
    | |_- not a struct, enum, or union
 
 error[E0517]: attribute should be applied to a struct, enum, or union
-  --> $DIR/naked-with-invalid-repr-attr.rs:32:8
+  --> $DIR/naked-with-invalid-repr-attr.rs:36:8
    |
 LL |   #[repr(C, packed)]
    |          ^
@@ -48,7 +48,7 @@ LL | | }
    | |_- not a struct, enum, or union
 
 error[E0517]: attribute should be applied to a struct or union
-  --> $DIR/naked-with-invalid-repr-attr.rs:32:11
+  --> $DIR/naked-with-invalid-repr-attr.rs:36:11
    |
 LL |   #[repr(C, packed)]
    |             ^^^^^^
@@ -61,7 +61,7 @@ LL | | }
    | |_- not a struct or union
 
 error[E0517]: attribute should be applied to an enum
-  --> $DIR/naked-with-invalid-repr-attr.rs:42:8
+  --> $DIR/naked-with-invalid-repr-attr.rs:46:8
    |
 LL |   #[repr(u8)]
    |          ^^
diff --git a/tests/ui/attributes/fn-align-dyn.rs b/tests/ui/attributes/fn-align-dyn.rs
index 8ba4d5e2897..3778c75a2ca 100644
--- a/tests/ui/attributes/fn-align-dyn.rs
+++ b/tests/ui/attributes/fn-align-dyn.rs
@@ -1,12 +1,15 @@
 //@ run-pass
 //@ ignore-wasm32 aligning functions is not currently supported on wasm (#143368)
+
+// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
+#![feature(rustc_attrs)]
 #![feature(fn_align)]
 
 trait Test {
-    #[align(4096)]
+    #[rustc_align(4096)]
     fn foo(&self);
 
-    #[align(4096)]
+    #[rustc_align(4096)]
     fn foo1(&self);
 }
 
diff --git a/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs b/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs
new file mode 100644
index 00000000000..536d6ff43fb
--- /dev/null
+++ b/tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs
@@ -0,0 +1,19 @@
+// 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 {
+    () => {
+        /* .. */
+    };
+}
+
+pub(crate) use align;
+
+fn main() {}
diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs
index 5026687b97b..d4c6ecaa189 100644
--- a/tests/ui/attributes/malformed-attrs.rs
+++ b/tests/ui/attributes/malformed-attrs.rs
@@ -3,6 +3,7 @@
 #![feature(rustc_attrs)]
 #![feature(rustc_allow_const_fn_unstable)]
 #![feature(allow_internal_unstable)]
+// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
 #![feature(fn_align)]
 #![feature(optimize_attribute)]
 #![feature(dropck_eyepatch)]
@@ -53,7 +54,7 @@
 #[inline = 5]
 //~^ ERROR valid forms for the attribute are
 //~| WARN this was previously accepted by the compiler
-#[align]
+#[rustc_align]
 //~^ ERROR malformed
 #[optimize]
 //~^ ERROR malformed
diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr
index 0d0c338d302..de53af851a3 100644
--- a/tests/ui/attributes/malformed-attrs.stderr
+++ b/tests/ui/attributes/malformed-attrs.stderr
@@ -1,5 +1,5 @@
 error[E0539]: malformed `cfg` attribute input
-  --> $DIR/malformed-attrs.rs:102:1
+  --> $DIR/malformed-attrs.rs:103:1
    |
 LL | #[cfg]
    | ^^^^^^
@@ -8,7 +8,7 @@ LL | #[cfg]
    | help: must be of the form: `#[cfg(predicate)]`
 
 error: malformed `cfg_attr` attribute input
-  --> $DIR/malformed-attrs.rs:104:1
+  --> $DIR/malformed-attrs.rs:105:1
    |
 LL | #[cfg_attr]
    | ^^^^^^^^^^^
@@ -20,67 +20,67 @@ LL | #[cfg_attr(condition, attribute, other_attribute, ...)]
    |           ++++++++++++++++++++++++++++++++++++++++++++
 
 error[E0463]: can't find crate for `wloop`
-  --> $DIR/malformed-attrs.rs:211:1
+  --> $DIR/malformed-attrs.rs:212:1
    |
 LL | extern crate wloop;
    | ^^^^^^^^^^^^^^^^^^^ can't find crate
 
 error: malformed `windows_subsystem` attribute input
-  --> $DIR/malformed-attrs.rs:29:1
+  --> $DIR/malformed-attrs.rs:30:1
    |
 LL | #![windows_subsystem]
    | ^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![windows_subsystem = "windows|console"]`
 
 error: malformed `crate_name` attribute input
-  --> $DIR/malformed-attrs.rs:74:1
+  --> $DIR/malformed-attrs.rs:75:1
    |
 LL | #[crate_name]
    | ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]`
 
 error: malformed `no_sanitize` attribute input
-  --> $DIR/malformed-attrs.rs:92:1
+  --> $DIR/malformed-attrs.rs:93:1
    |
 LL | #[no_sanitize]
    | ^^^^^^^^^^^^^^ help: must be of the form: `#[no_sanitize(address, kcfi, memory, thread)]`
 
 error: malformed `proc_macro` attribute input
-  --> $DIR/malformed-attrs.rs:99:1
+  --> $DIR/malformed-attrs.rs:100:1
    |
 LL | #[proc_macro = 18]
    | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro]`
 
 error: malformed `instruction_set` attribute input
-  --> $DIR/malformed-attrs.rs:106:1
+  --> $DIR/malformed-attrs.rs:107:1
    |
 LL | #[instruction_set]
    | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[instruction_set(set)]`
 
 error: malformed `patchable_function_entry` attribute input
-  --> $DIR/malformed-attrs.rs:108:1
+  --> $DIR/malformed-attrs.rs:109:1
    |
 LL | #[patchable_function_entry]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
 
 error: malformed `coroutine` attribute input
-  --> $DIR/malformed-attrs.rs:111:5
+  --> $DIR/malformed-attrs.rs:112:5
    |
 LL |     #[coroutine = 63] || {}
    |     ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[coroutine]`
 
 error: malformed `proc_macro_attribute` attribute input
-  --> $DIR/malformed-attrs.rs:116:1
+  --> $DIR/malformed-attrs.rs:117:1
    |
 LL | #[proc_macro_attribute = 19]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro_attribute]`
 
 error: malformed `proc_macro_derive` attribute input
-  --> $DIR/malformed-attrs.rs:123:1
+  --> $DIR/malformed-attrs.rs:124:1
    |
 LL | #[proc_macro_derive]
    | ^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]`
 
 error: malformed `must_not_suspend` attribute input
-  --> $DIR/malformed-attrs.rs:132:1
+  --> $DIR/malformed-attrs.rs:133:1
    |
 LL | #[must_not_suspend()]
    | ^^^^^^^^^^^^^^^^^^^^^
@@ -95,67 +95,67 @@ LL + #[must_not_suspend]
    |
 
 error: malformed `cfi_encoding` attribute input
-  --> $DIR/malformed-attrs.rs:134:1
+  --> $DIR/malformed-attrs.rs:135:1
    |
 LL | #[cfi_encoding]
    | ^^^^^^^^^^^^^^^ help: must be of the form: `#[cfi_encoding = "encoding"]`
 
 error: malformed `linkage` attribute input
-  --> $DIR/malformed-attrs.rs:173:5
+  --> $DIR/malformed-attrs.rs:174:5
    |
 LL |     #[linkage]
    |     ^^^^^^^^^^ help: must be of the form: `#[linkage = "external|internal|..."]`
 
 error: malformed `allow` attribute input
-  --> $DIR/malformed-attrs.rs:178:1
+  --> $DIR/malformed-attrs.rs:179:1
    |
 LL | #[allow]
    | ^^^^^^^^ help: must be of the form: `#[allow(lint1, lint2, ..., /*opt*/ reason = "...")]`
 
 error: malformed `expect` attribute input
-  --> $DIR/malformed-attrs.rs:180:1
+  --> $DIR/malformed-attrs.rs:181:1
    |
 LL | #[expect]
    | ^^^^^^^^^ help: must be of the form: `#[expect(lint1, lint2, ..., /*opt*/ reason = "...")]`
 
 error: malformed `warn` attribute input
-  --> $DIR/malformed-attrs.rs:182:1
+  --> $DIR/malformed-attrs.rs:183:1
    |
 LL | #[warn]
    | ^^^^^^^ help: must be of the form: `#[warn(lint1, lint2, ..., /*opt*/ reason = "...")]`
 
 error: malformed `deny` attribute input
-  --> $DIR/malformed-attrs.rs:184:1
+  --> $DIR/malformed-attrs.rs:185:1
    |
 LL | #[deny]
    | ^^^^^^^ help: must be of the form: `#[deny(lint1, lint2, ..., /*opt*/ reason = "...")]`
 
 error: malformed `forbid` attribute input
-  --> $DIR/malformed-attrs.rs:186:1
+  --> $DIR/malformed-attrs.rs:187:1
    |
 LL | #[forbid]
    | ^^^^^^^^^ help: must be of the form: `#[forbid(lint1, lint2, ..., /*opt*/ reason = "...")]`
 
 error: malformed `debugger_visualizer` attribute input
-  --> $DIR/malformed-attrs.rs:188:1
+  --> $DIR/malformed-attrs.rs:189:1
    |
 LL | #[debugger_visualizer]
    | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]`
 
 error: malformed `thread_local` attribute input
-  --> $DIR/malformed-attrs.rs:203:1
+  --> $DIR/malformed-attrs.rs:204:1
    |
 LL | #[thread_local()]
    | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[thread_local]`
 
 error: malformed `no_link` attribute input
-  --> $DIR/malformed-attrs.rs:207:1
+  --> $DIR/malformed-attrs.rs:208:1
    |
 LL | #[no_link()]
    | ^^^^^^^^^^^^ help: must be of the form: `#[no_link]`
 
 error: malformed `macro_use` attribute input
-  --> $DIR/malformed-attrs.rs:209:1
+  --> $DIR/malformed-attrs.rs:210:1
    |
 LL | #[macro_use = 1]
    | ^^^^^^^^^^^^^^^^
@@ -170,7 +170,7 @@ LL + #[macro_use]
    |
 
 error: malformed `macro_export` attribute input
-  --> $DIR/malformed-attrs.rs:214:1
+  --> $DIR/malformed-attrs.rs:215:1
    |
 LL | #[macro_export = 18]
    | ^^^^^^^^^^^^^^^^^^^^
@@ -185,31 +185,31 @@ LL + #[macro_export]
    |
 
 error: malformed `allow_internal_unsafe` attribute input
-  --> $DIR/malformed-attrs.rs:216:1
+  --> $DIR/malformed-attrs.rs:217:1
    |
 LL | #[allow_internal_unsafe = 1]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[allow_internal_unsafe]`
 
 error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type
-  --> $DIR/malformed-attrs.rs:99:1
+  --> $DIR/malformed-attrs.rs:100:1
    |
 LL | #[proc_macro = 18]
    | ^^^^^^^^^^^^^^^^^^
 
 error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type
-  --> $DIR/malformed-attrs.rs:116:1
+  --> $DIR/malformed-attrs.rs:117:1
    |
 LL | #[proc_macro_attribute = 19]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type
-  --> $DIR/malformed-attrs.rs:123:1
+  --> $DIR/malformed-attrs.rs:124:1
    |
 LL | #[proc_macro_derive]
    | ^^^^^^^^^^^^^^^^^^^^
 
 error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint
-  --> $DIR/malformed-attrs.rs:216:1
+  --> $DIR/malformed-attrs.rs:217:1
    |
 LL | #[allow_internal_unsafe = 1]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -218,7 +218,7 @@ LL | #[allow_internal_unsafe = 1]
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error: valid forms for the attribute are `#[doc(hidden|inline|...)]` and `#[doc = "string"]`
-  --> $DIR/malformed-attrs.rs:43:1
+  --> $DIR/malformed-attrs.rs:44:1
    |
 LL | #[doc]
    | ^^^^^^
@@ -228,7 +228,7 @@ LL | #[doc]
    = note: `#[deny(ill_formed_attribute_input)]` on by default
 
 error: valid forms for the attribute are `#[doc(hidden|inline|...)]` and `#[doc = "string"]`
-  --> $DIR/malformed-attrs.rs:76:1
+  --> $DIR/malformed-attrs.rs:77:1
    |
 LL | #[doc]
    | ^^^^^^
@@ -237,7 +237,7 @@ LL | #[doc]
    = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
 
 error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]`
-  --> $DIR/malformed-attrs.rs:83:1
+  --> $DIR/malformed-attrs.rs:84:1
    |
 LL | #[link]
    | ^^^^^^^
@@ -246,7 +246,7 @@ LL | #[link]
    = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
 
 error: invalid argument
-  --> $DIR/malformed-attrs.rs:188:1
+  --> $DIR/malformed-attrs.rs:189:1
    |
 LL | #[debugger_visualizer]
    | ^^^^^^^^^^^^^^^^^^^^^^
@@ -256,7 +256,7 @@ LL | #[debugger_visualizer]
    = note: expected: `gdb_script_file = "..."`
 
 error[E0565]: malformed `omit_gdb_pretty_printer_section` attribute input
-  --> $DIR/malformed-attrs.rs:26:1
+  --> $DIR/malformed-attrs.rs:27:1
    |
 LL | #![omit_gdb_pretty_printer_section = 1]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---^
@@ -265,25 +265,25 @@ LL | #![omit_gdb_pretty_printer_section = 1]
    | help: must be of the form: `#[omit_gdb_pretty_printer_section]`
 
 error[E0539]: malformed `export_name` attribute input
-  --> $DIR/malformed-attrs.rs:32:1
+  --> $DIR/malformed-attrs.rs:33:1
    |
 LL | #[unsafe(export_name)]
    | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]`
 
 error: `rustc_allow_const_fn_unstable` expects a list of feature names
-  --> $DIR/malformed-attrs.rs:34:1
+  --> $DIR/malformed-attrs.rs:35:1
    |
 LL | #[rustc_allow_const_fn_unstable]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: `allow_internal_unstable` expects a list of feature names
-  --> $DIR/malformed-attrs.rs:37:1
+  --> $DIR/malformed-attrs.rs:38:1
    |
 LL | #[allow_internal_unstable]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0539]: malformed `rustc_confusables` attribute input
-  --> $DIR/malformed-attrs.rs:39:1
+  --> $DIR/malformed-attrs.rs:40:1
    |
 LL | #[rustc_confusables]
    | ^^^^^^^^^^^^^^^^^^^^
@@ -292,7 +292,7 @@ LL | #[rustc_confusables]
    | help: must be of the form: `#[rustc_confusables("name1", "name2", ...)]`
 
 error[E0539]: malformed `deprecated` attribute input
-  --> $DIR/malformed-attrs.rs:41:1
+  --> $DIR/malformed-attrs.rs:42:1
    |
 LL | #[deprecated = 5]
    | ^^^^^^^^^^^^^^^-^
@@ -312,13 +312,13 @@ LL + #[deprecated]
    |
 
 error[E0539]: malformed `rustc_macro_transparency` attribute input
-  --> $DIR/malformed-attrs.rs:46:1
+  --> $DIR/malformed-attrs.rs:47:1
    |
 LL | #[rustc_macro_transparency]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_macro_transparency = "transparent|semitransparent|opaque"]`
 
 error[E0539]: malformed `repr` attribute input
-  --> $DIR/malformed-attrs.rs:48:1
+  --> $DIR/malformed-attrs.rs:49:1
    |
 LL | #[repr]
    | ^^^^^^^
@@ -327,7 +327,7 @@ LL | #[repr]
    | help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]`
 
 error[E0565]: malformed `rustc_as_ptr` attribute input
-  --> $DIR/malformed-attrs.rs:51:1
+  --> $DIR/malformed-attrs.rs:52:1
    |
 LL | #[rustc_as_ptr = 5]
    | ^^^^^^^^^^^^^^^---^
@@ -335,17 +335,17 @@ LL | #[rustc_as_ptr = 5]
    | |              didn't expect any arguments here
    | help: must be of the form: `#[rustc_as_ptr]`
 
-error[E0539]: malformed `align` attribute input
-  --> $DIR/malformed-attrs.rs:56:1
+error[E0539]: malformed `rustc_align` attribute input
+  --> $DIR/malformed-attrs.rs:57:1
    |
-LL | #[align]
-   | ^^^^^^^^
+LL | #[rustc_align]
+   | ^^^^^^^^^^^^^^
    | |
    | expected this to be a list
-   | help: must be of the form: `#[align(<alignment in bytes>)]`
+   | help: must be of the form: `#[rustc_align(<alignment in bytes>)]`
 
 error[E0539]: malformed `optimize` attribute input
-  --> $DIR/malformed-attrs.rs:58:1
+  --> $DIR/malformed-attrs.rs:59:1
    |
 LL | #[optimize]
    | ^^^^^^^^^^^
@@ -354,7 +354,7 @@ LL | #[optimize]
    | help: must be of the form: `#[optimize(size|speed|none)]`
 
 error[E0565]: malformed `cold` attribute input
-  --> $DIR/malformed-attrs.rs:60:1
+  --> $DIR/malformed-attrs.rs:61:1
    |
 LL | #[cold = 1]
    | ^^^^^^^---^
@@ -363,13 +363,13 @@ LL | #[cold = 1]
    | help: must be of the form: `#[cold]`
 
 error: valid forms for the attribute are `#[must_use = "reason"]` and `#[must_use]`
-  --> $DIR/malformed-attrs.rs:62:1
+  --> $DIR/malformed-attrs.rs:63:1
    |
 LL | #[must_use()]
    | ^^^^^^^^^^^^^
 
 error[E0565]: malformed `no_mangle` attribute input
-  --> $DIR/malformed-attrs.rs:64:1
+  --> $DIR/malformed-attrs.rs:65:1
    |
 LL | #[no_mangle = 1]
    | ^^^^^^^^^^^^---^
@@ -378,7 +378,7 @@ LL | #[no_mangle = 1]
    | help: must be of the form: `#[no_mangle]`
 
 error[E0565]: malformed `naked` attribute input
-  --> $DIR/malformed-attrs.rs:66:1
+  --> $DIR/malformed-attrs.rs:67:1
    |
 LL | #[unsafe(naked())]
    | ^^^^^^^^^^^^^^--^^
@@ -387,7 +387,7 @@ LL | #[unsafe(naked())]
    | help: must be of the form: `#[naked]`
 
 error[E0565]: malformed `track_caller` attribute input
-  --> $DIR/malformed-attrs.rs:68:1
+  --> $DIR/malformed-attrs.rs:69:1
    |
 LL | #[track_caller()]
    | ^^^^^^^^^^^^^^--^
@@ -396,13 +396,13 @@ LL | #[track_caller()]
    | help: must be of the form: `#[track_caller]`
 
 error[E0539]: malformed `export_name` attribute input
-  --> $DIR/malformed-attrs.rs:70:1
+  --> $DIR/malformed-attrs.rs:71:1
    |
 LL | #[export_name()]
    | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]`
 
 error[E0805]: malformed `used` attribute input
-  --> $DIR/malformed-attrs.rs:72:1
+  --> $DIR/malformed-attrs.rs:73:1
    |
 LL | #[used()]
    | ^^^^^^--^
@@ -418,7 +418,7 @@ LL + #[used]
    |
 
 error[E0539]: malformed `target_feature` attribute input
-  --> $DIR/malformed-attrs.rs:79:1
+  --> $DIR/malformed-attrs.rs:80:1
    |
 LL | #[target_feature]
    | ^^^^^^^^^^^^^^^^^
@@ -427,7 +427,7 @@ LL | #[target_feature]
    | help: must be of the form: `#[target_feature(enable = "feat1, feat2")]`
 
 error[E0565]: malformed `export_stable` attribute input
-  --> $DIR/malformed-attrs.rs:81:1
+  --> $DIR/malformed-attrs.rs:82:1
    |
 LL | #[export_stable = 1]
    | ^^^^^^^^^^^^^^^^---^
@@ -436,19 +436,19 @@ LL | #[export_stable = 1]
    | help: must be of the form: `#[export_stable]`
 
 error[E0539]: malformed `link_name` attribute input
-  --> $DIR/malformed-attrs.rs:86:1
+  --> $DIR/malformed-attrs.rs:87:1
    |
 LL | #[link_name]
    | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
 
 error[E0539]: malformed `link_section` attribute input
-  --> $DIR/malformed-attrs.rs:88:1
+  --> $DIR/malformed-attrs.rs:89:1
    |
 LL | #[link_section]
    | ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]`
 
 error[E0539]: malformed `coverage` attribute input
-  --> $DIR/malformed-attrs.rs:90:1
+  --> $DIR/malformed-attrs.rs:91:1
    |
 LL | #[coverage]
    | ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -461,7 +461,7 @@ LL | #[coverage(on)]
    |           ++++
 
 error[E0565]: malformed `no_implicit_prelude` attribute input
-  --> $DIR/malformed-attrs.rs:97:1
+  --> $DIR/malformed-attrs.rs:98:1
    |
 LL | #[no_implicit_prelude = 23]
    | ^^^^^^^^^^^^^^^^^^^^^^----^
@@ -470,7 +470,7 @@ LL | #[no_implicit_prelude = 23]
    | help: must be of the form: `#[no_implicit_prelude]`
 
 error[E0539]: malformed `must_use` attribute input
-  --> $DIR/malformed-attrs.rs:119:1
+  --> $DIR/malformed-attrs.rs:120:1
    |
 LL | #[must_use = 1]
    | ^^^^^^^^^^^^^-^
@@ -487,7 +487,7 @@ LL + #[must_use]
    |
 
 error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input
-  --> $DIR/malformed-attrs.rs:128:1
+  --> $DIR/malformed-attrs.rs:129:1
    |
 LL | #[rustc_layout_scalar_valid_range_start]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -496,7 +496,7 @@ LL | #[rustc_layout_scalar_valid_range_start]
    | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]`
 
 error[E0539]: malformed `rustc_layout_scalar_valid_range_end` attribute input
-  --> $DIR/malformed-attrs.rs:130:1
+  --> $DIR/malformed-attrs.rs:131:1
    |
 LL | #[rustc_layout_scalar_valid_range_end]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -505,7 +505,7 @@ LL | #[rustc_layout_scalar_valid_range_end]
    | help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]`
 
 error[E0565]: malformed `marker` attribute input
-  --> $DIR/malformed-attrs.rs:155:1
+  --> $DIR/malformed-attrs.rs:156:1
    |
 LL | #[marker = 3]
    | ^^^^^^^^^---^
@@ -514,7 +514,7 @@ LL | #[marker = 3]
    | help: must be of the form: `#[marker]`
 
 error[E0565]: malformed `fundamental` attribute input
-  --> $DIR/malformed-attrs.rs:157:1
+  --> $DIR/malformed-attrs.rs:158:1
    |
 LL | #[fundamental()]
    | ^^^^^^^^^^^^^--^
@@ -523,7 +523,7 @@ LL | #[fundamental()]
    | help: must be of the form: `#[fundamental]`
 
 error[E0565]: malformed `ffi_pure` attribute input
-  --> $DIR/malformed-attrs.rs:165:5
+  --> $DIR/malformed-attrs.rs:166:5
    |
 LL |     #[unsafe(ffi_pure = 1)]
    |     ^^^^^^^^^^^^^^^^^^---^^
@@ -532,7 +532,7 @@ LL |     #[unsafe(ffi_pure = 1)]
    |     help: must be of the form: `#[ffi_pure]`
 
 error[E0539]: malformed `link_ordinal` attribute input
-  --> $DIR/malformed-attrs.rs:167:5
+  --> $DIR/malformed-attrs.rs:168:5
    |
 LL |     #[link_ordinal]
    |     ^^^^^^^^^^^^^^^
@@ -541,7 +541,7 @@ LL |     #[link_ordinal]
    |     help: must be of the form: `#[link_ordinal(ordinal)]`
 
 error[E0565]: malformed `ffi_const` attribute input
-  --> $DIR/malformed-attrs.rs:171:5
+  --> $DIR/malformed-attrs.rs:172:5
    |
 LL |     #[unsafe(ffi_const = 1)]
    |     ^^^^^^^^^^^^^^^^^^^---^^
@@ -550,7 +550,7 @@ LL |     #[unsafe(ffi_const = 1)]
    |     help: must be of the form: `#[ffi_const]`
 
 error[E0565]: malformed `automatically_derived` attribute input
-  --> $DIR/malformed-attrs.rs:191:1
+  --> $DIR/malformed-attrs.rs:192:1
    |
 LL | #[automatically_derived = 18]
    | ^^^^^^^^^^^^^^^^^^^^^^^^----^
@@ -559,7 +559,7 @@ LL | #[automatically_derived = 18]
    | help: must be of the form: `#[automatically_derived]`
 
 error[E0565]: malformed `non_exhaustive` attribute input
-  --> $DIR/malformed-attrs.rs:197:1
+  --> $DIR/malformed-attrs.rs:198:1
    |
 LL | #[non_exhaustive = 1]
    | ^^^^^^^^^^^^^^^^^---^
@@ -568,7 +568,7 @@ LL | #[non_exhaustive = 1]
    | help: must be of the form: `#[non_exhaustive]`
 
 error[E0565]: malformed `type_const` attribute input
-  --> $DIR/malformed-attrs.rs:143:5
+  --> $DIR/malformed-attrs.rs:144:5
    |
 LL |     #[type_const = 1]
    |     ^^^^^^^^^^^^^---^
@@ -577,7 +577,7 @@ LL |     #[type_const = 1]
    |     help: must be of the form: `#[type_const]`
 
 error: attribute should be applied to `const fn`
-  --> $DIR/malformed-attrs.rs:34:1
+  --> $DIR/malformed-attrs.rs:35:1
    |
 LL |   #[rustc_allow_const_fn_unstable]
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -589,19 +589,19 @@ LL | | }
    | |_- not a `const fn`
 
 error: `#[repr(align(...))]` is not supported on function items
-  --> $DIR/malformed-attrs.rs:48:1
+  --> $DIR/malformed-attrs.rs:49:1
    |
 LL | #[repr]
    | ^^^^^^^
    |
-help: use `#[align(...)]` instead
-  --> $DIR/malformed-attrs.rs:48:1
+help: use `#[rustc_align(...)]` instead
+  --> $DIR/malformed-attrs.rs:49:1
    |
 LL | #[repr]
    | ^^^^^^^
 
 warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
-  --> $DIR/malformed-attrs.rs:149:1
+  --> $DIR/malformed-attrs.rs:150:1
    |
 LL | #[diagnostic::do_not_recommend()]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -609,7 +609,7 @@ LL | #[diagnostic::do_not_recommend()]
    = note: `#[warn(malformed_diagnostic_attributes)]` on by default
 
 warning: missing options for `on_unimplemented` attribute
-  --> $DIR/malformed-attrs.rs:138:1
+  --> $DIR/malformed-attrs.rs:139:1
    |
 LL | #[diagnostic::on_unimplemented]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -617,7 +617,7 @@ LL | #[diagnostic::on_unimplemented]
    = help: at least one of the `message`, `note` and `label` options are expected
 
 warning: malformed `on_unimplemented` attribute
-  --> $DIR/malformed-attrs.rs:140:1
+  --> $DIR/malformed-attrs.rs:141:1
    |
 LL | #[diagnostic::on_unimplemented = 1]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
@@ -625,7 +625,7 @@ LL | #[diagnostic::on_unimplemented = 1]
    = help: only `message`, `note` and `label` are allowed as options
 
 error: valid forms for the attribute are `#[inline(always|never)]` and `#[inline]`
-  --> $DIR/malformed-attrs.rs:53:1
+  --> $DIR/malformed-attrs.rs:54:1
    |
 LL | #[inline = 5]
    | ^^^^^^^^^^^^^
@@ -634,7 +634,7 @@ LL | #[inline = 5]
    = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
 
 error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
-  --> $DIR/malformed-attrs.rs:94:1
+  --> $DIR/malformed-attrs.rs:95:1
    |
 LL | #[ignore()]
    | ^^^^^^^^^^^
@@ -643,7 +643,7 @@ LL | #[ignore()]
    = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
 
 error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
-  --> $DIR/malformed-attrs.rs:223:1
+  --> $DIR/malformed-attrs.rs:224:1
    |
 LL | #[ignore = 1]
    | ^^^^^^^^^^^^^
@@ -652,7 +652,7 @@ LL | #[ignore = 1]
    = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
 
 error[E0308]: mismatched types
-  --> $DIR/malformed-attrs.rs:111:23
+  --> $DIR/malformed-attrs.rs:112:23
    |
 LL | fn test() {
    |          - help: a return type might be missing here: `-> _`
@@ -660,7 +660,7 @@ LL |     #[coroutine = 63] || {}
    |                       ^^^^^ expected `()`, found coroutine
    |
    = note: expected unit type `()`
-              found coroutine `{coroutine@$DIR/malformed-attrs.rs:111:23: 111:25}`
+              found coroutine `{coroutine@$DIR/malformed-attrs.rs:112:23: 112:25}`
 
 error: aborting due to 75 previous errors; 3 warnings emitted
 
diff --git a/tests/ui/attributes/malformed-fn-align.rs b/tests/ui/attributes/malformed-fn-align.rs
index e06e6116842..cf143b28e54 100644
--- a/tests/ui/attributes/malformed-fn-align.rs
+++ b/tests/ui/attributes/malformed-fn-align.rs
@@ -1,49 +1,54 @@
+// ignore-tidy-linelength
+
+// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
+#![feature(rustc_attrs)]
 #![feature(fn_align)]
+
 #![crate_type = "lib"]
 
 trait MyTrait {
-    #[align] //~ ERROR malformed `align` attribute input
+    #[rustc_align] //~ ERROR malformed `rustc_align` attribute input
     fn myfun1();
 
-    #[align(1, 2)] //~ ERROR malformed `align` attribute input
+    #[rustc_align(1, 2)] //~ ERROR malformed `rustc_align` attribute input
     fn myfun2();
 }
 
-#[align = 16] //~ ERROR malformed `align` attribute input
+#[rustc_align = 16] //~ ERROR malformed `rustc_align` attribute input
 fn f1() {}
 
-#[align("hello")] //~ ERROR invalid alignment value: not an unsuffixed integer
+#[rustc_align("hello")] //~ ERROR invalid alignment value: not an unsuffixed integer
 fn f2() {}
 
-#[align(0)] //~ ERROR invalid alignment value: not a power of two
+#[rustc_align(0)] //~ ERROR invalid alignment value: not a power of two
 fn f3() {}
 
 #[repr(align(16))] //~ ERROR `#[repr(align(...))]` is not supported on function items
 fn f4() {}
 
-#[align(-1)] //~ ERROR expected unsuffixed literal, found `-`
+#[rustc_align(-1)] //~ ERROR expected unsuffixed literal, found `-`
 fn f5() {}
 
-#[align(3)] //~ ERROR invalid alignment value: not a power of two
+#[rustc_align(3)] //~ ERROR invalid alignment value: not a power of two
 fn f6() {}
 
-#[align(4usize)] //~ ERROR invalid alignment value: not an unsuffixed integer [E0589]
+#[rustc_align(4usize)] //~ ERROR invalid alignment value: not an unsuffixed integer [E0589]
 //~^ ERROR suffixed literals are not allowed in attributes
 fn f7() {}
 
-#[align(16)]
-#[align(3)] //~ ERROR invalid alignment value: not a power of two
-#[align(16)]
+#[rustc_align(16)]
+#[rustc_align(3)] //~ ERROR invalid alignment value: not a power of two
+#[rustc_align(16)]
 fn f8() {}
 
-#[align(16)] //~ ERROR `#[align(...)]` is not supported on struct items
+#[rustc_align(16)] //~ ERROR `#[rustc_align(...)]` is not supported on struct items
 struct S1;
 
-#[align(32)] //~ ERROR `#[align(...)]` should be applied to a function item
+#[rustc_align(32)] //~ ERROR `#[rustc_align(...)]` should be applied to a function item
 const FOO: i32 = 42;
 
-#[align(32)] //~ ERROR `#[align(...)]` should be applied to a function item
+#[rustc_align(32)] //~ ERROR `#[rustc_align(...)]` should be applied to a function item
 mod test {}
 
-#[align(32)] //~ ERROR `#[align(...)]` should be applied to a function item
+#[rustc_align(32)] //~ ERROR `#[rustc_align(...)]` should be applied to a function item
 use ::std::iter;
diff --git a/tests/ui/attributes/malformed-fn-align.stderr b/tests/ui/attributes/malformed-fn-align.stderr
index af3625b1f3b..d995a7bf070 100644
--- a/tests/ui/attributes/malformed-fn-align.stderr
+++ b/tests/ui/attributes/malformed-fn-align.stderr
@@ -1,119 +1,119 @@
 error: expected unsuffixed literal, found `-`
-  --> $DIR/malformed-fn-align.rs:24:9
+  --> $DIR/malformed-fn-align.rs:29:15
    |
-LL | #[align(-1)]
-   |         ^
+LL | #[rustc_align(-1)]
+   |               ^
 
 error: suffixed literals are not allowed in attributes
-  --> $DIR/malformed-fn-align.rs:30:9
+  --> $DIR/malformed-fn-align.rs:35:15
    |
-LL | #[align(4usize)]
-   |         ^^^^^^
+LL | #[rustc_align(4usize)]
+   |               ^^^^^^
    |
    = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
 
-error[E0539]: malformed `align` attribute input
-  --> $DIR/malformed-fn-align.rs:5:5
+error[E0539]: malformed `rustc_align` attribute input
+  --> $DIR/malformed-fn-align.rs:10:5
    |
-LL |     #[align]
-   |     ^^^^^^^^
+LL |     #[rustc_align]
+   |     ^^^^^^^^^^^^^^
    |     |
    |     expected this to be a list
-   |     help: must be of the form: `#[align(<alignment in bytes>)]`
+   |     help: must be of the form: `#[rustc_align(<alignment in bytes>)]`
 
-error[E0805]: malformed `align` attribute input
-  --> $DIR/malformed-fn-align.rs:8:5
+error[E0805]: malformed `rustc_align` attribute input
+  --> $DIR/malformed-fn-align.rs:13:5
    |
-LL |     #[align(1, 2)]
-   |     ^^^^^^^------^
-   |     |      |
-   |     |      expected a single argument here
-   |     help: must be of the form: `#[align(<alignment in bytes>)]`
+LL |     #[rustc_align(1, 2)]
+   |     ^^^^^^^^^^^^^------^
+   |     |            |
+   |     |            expected a single argument here
+   |     help: must be of the form: `#[rustc_align(<alignment in bytes>)]`
 
-error[E0539]: malformed `align` attribute input
-  --> $DIR/malformed-fn-align.rs:12:1
+error[E0539]: malformed `rustc_align` attribute input
+  --> $DIR/malformed-fn-align.rs:17:1
    |
-LL | #[align = 16]
-   | ^^^^^^^^^^^^^
+LL | #[rustc_align = 16]
+   | ^^^^^^^^^^^^^^^^^^^
    | |
    | expected this to be a list
-   | help: must be of the form: `#[align(<alignment in bytes>)]`
+   | help: must be of the form: `#[rustc_align(<alignment in bytes>)]`
 
 error[E0589]: invalid alignment value: not an unsuffixed integer
-  --> $DIR/malformed-fn-align.rs:15:9
+  --> $DIR/malformed-fn-align.rs:20:15
    |
-LL | #[align("hello")]
-   |         ^^^^^^^
+LL | #[rustc_align("hello")]
+   |               ^^^^^^^
 
 error[E0589]: invalid alignment value: not a power of two
-  --> $DIR/malformed-fn-align.rs:18:9
+  --> $DIR/malformed-fn-align.rs:23:15
    |
-LL | #[align(0)]
-   |         ^
+LL | #[rustc_align(0)]
+   |               ^
 
 error[E0589]: invalid alignment value: not a power of two
-  --> $DIR/malformed-fn-align.rs:27:9
+  --> $DIR/malformed-fn-align.rs:32:15
    |
-LL | #[align(3)]
-   |         ^
+LL | #[rustc_align(3)]
+   |               ^
 
 error[E0589]: invalid alignment value: not an unsuffixed integer
-  --> $DIR/malformed-fn-align.rs:30:9
+  --> $DIR/malformed-fn-align.rs:35:15
    |
-LL | #[align(4usize)]
-   |         ^^^^^^
+LL | #[rustc_align(4usize)]
+   |               ^^^^^^
 
 error[E0589]: invalid alignment value: not a power of two
-  --> $DIR/malformed-fn-align.rs:35:9
+  --> $DIR/malformed-fn-align.rs:40:15
    |
-LL | #[align(3)]
-   |         ^
+LL | #[rustc_align(3)]
+   |               ^
 
 error: `#[repr(align(...))]` is not supported on function items
-  --> $DIR/malformed-fn-align.rs:21:8
+  --> $DIR/malformed-fn-align.rs:26:8
    |
 LL | #[repr(align(16))]
    |        ^^^^^^^^^
    |
-help: use `#[align(...)]` instead
-  --> $DIR/malformed-fn-align.rs:21:8
+help: use `#[rustc_align(...)]` instead
+  --> $DIR/malformed-fn-align.rs:26:8
    |
 LL | #[repr(align(16))]
    |        ^^^^^^^^^
 
-error: `#[align(...)]` is not supported on struct items
-  --> $DIR/malformed-fn-align.rs:39:1
+error: `#[rustc_align(...)]` is not supported on struct items
+  --> $DIR/malformed-fn-align.rs:44:1
    |
-LL | #[align(16)]
-   | ^^^^^^^^^^^^
+LL | #[rustc_align(16)]
+   | ^^^^^^^^^^^^^^^^^^
    |
 help: use `#[repr(align(...))]` instead
    |
-LL - #[align(16)]
+LL - #[rustc_align(16)]
 LL + #[repr(align(16))]
    |
 
-error: `#[align(...)]` should be applied to a function item
-  --> $DIR/malformed-fn-align.rs:42:1
+error: `#[rustc_align(...)]` should be applied to a function item
+  --> $DIR/malformed-fn-align.rs:47:1
    |
-LL | #[align(32)]
-   | ^^^^^^^^^^^^
+LL | #[rustc_align(32)]
+   | ^^^^^^^^^^^^^^^^^^
 LL | const FOO: i32 = 42;
    | -------------------- not a function item
 
-error: `#[align(...)]` should be applied to a function item
-  --> $DIR/malformed-fn-align.rs:45:1
+error: `#[rustc_align(...)]` should be applied to a function item
+  --> $DIR/malformed-fn-align.rs:50:1
    |
-LL | #[align(32)]
-   | ^^^^^^^^^^^^
+LL | #[rustc_align(32)]
+   | ^^^^^^^^^^^^^^^^^^
 LL | mod test {}
    | ----------- not a function item
 
-error: `#[align(...)]` should be applied to a function item
-  --> $DIR/malformed-fn-align.rs:48:1
+error: `#[rustc_align(...)]` should be applied to a function item
+  --> $DIR/malformed-fn-align.rs:53:1
    |
-LL | #[align(32)]
-   | ^^^^^^^^^^^^
+LL | #[rustc_align(32)]
+   | ^^^^^^^^^^^^^^^^^^
 LL | use ::std::iter;
    | ---------------- not a function item
 
diff --git a/tests/ui/feature-gates/feature-gate-fn_align.rs b/tests/ui/feature-gates/feature-gate-fn_align.rs
index b6c300e5cbe..36e17c4a8dd 100644
--- a/tests/ui/feature-gates/feature-gate-fn_align.rs
+++ b/tests/ui/feature-gates/feature-gate-fn_align.rs
@@ -1,12 +1,16 @@
 #![crate_type = "lib"]
 
-#[align(16)]
-//~^ ERROR the `#[align]` attribute is an experimental feature
+// ignore-tidy-linelength
+
+// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
+
+#[rustc_align(16)]
+//~^ ERROR the `#[rustc_align]` attribute is an experimental feature
 fn requires_alignment() {}
 
 trait MyTrait {
-    #[align]
-    //~^ ERROR the `#[align]` attribute is an experimental feature
-    //~| ERROR malformed `align` attribute input
+    #[rustc_align]
+    //~^ ERROR the `#[rustc_align]` attribute is an experimental feature
+    //~| ERROR malformed `rustc_align` attribute input
     fn myfun();
 }
diff --git a/tests/ui/feature-gates/feature-gate-fn_align.stderr b/tests/ui/feature-gates/feature-gate-fn_align.stderr
index 921cf08435c..6196f4f298f 100644
--- a/tests/ui/feature-gates/feature-gate-fn_align.stderr
+++ b/tests/ui/feature-gates/feature-gate-fn_align.stderr
@@ -1,31 +1,31 @@
-error[E0658]: the `#[align]` attribute is an experimental feature
-  --> $DIR/feature-gate-fn_align.rs:3:1
+error[E0658]: the `#[rustc_align]` attribute is an experimental feature
+  --> $DIR/feature-gate-fn_align.rs:7:1
    |
-LL | #[align(16)]
-   | ^^^^^^^^^^^^
+LL | #[rustc_align(16)]
+   | ^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #82232 <https://github.com/rust-lang/rust/issues/82232> for more information
    = help: add `#![feature(fn_align)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0658]: the `#[align]` attribute is an experimental feature
-  --> $DIR/feature-gate-fn_align.rs:8:5
+error[E0658]: the `#[rustc_align]` attribute is an experimental feature
+  --> $DIR/feature-gate-fn_align.rs:12:5
    |
-LL |     #[align]
-   |     ^^^^^^^^
+LL |     #[rustc_align]
+   |     ^^^^^^^^^^^^^^
    |
    = note: see issue #82232 <https://github.com/rust-lang/rust/issues/82232> for more information
    = help: add `#![feature(fn_align)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0539]: malformed `align` attribute input
-  --> $DIR/feature-gate-fn_align.rs:8:5
+error[E0539]: malformed `rustc_align` attribute input
+  --> $DIR/feature-gate-fn_align.rs:12:5
    |
-LL |     #[align]
-   |     ^^^^^^^^
+LL |     #[rustc_align]
+   |     ^^^^^^^^^^^^^^
    |     |
    |     expected this to be a list
-   |     help: must be of the form: `#[align(<alignment in bytes>)]`
+   |     help: must be of the form: `#[rustc_align(<alignment in bytes>)]`
 
 error: aborting due to 3 previous errors