diff options
| author | Jieyou Xu <jieyouxu@outlook.com> | 2025-07-18 00:10:46 +0800 |
|---|---|---|
| committer | Jieyou Xu <jieyouxu@outlook.com> | 2025-07-19 01:42:30 +0800 |
| commit | 69b71e44107b4905ec7ad84ccb3edf4f14b3df69 (patch) | |
| tree | fa801205d444880c9972c2701eef39bafc453b08 /tests/codegen/min-function-alignment.rs | |
| parent | b2e94bf020a99473cf80f05f410af8a5cfc486a6 (diff) | |
| download | rust-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 'tests/codegen/min-function-alignment.rs')
| -rw-r--r-- | tests/codegen/min-function-alignment.rs | 6 |
1 files changed, 4 insertions, 2 deletions
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 |
