rust/tests/ui/attributes/malformed-static-align.rs
Folkert de Vries cbacd00f10
allow #[rustc_align_static(N)] on statics
We need a different attribute than `rustc_align` because unstable attributes are
tied to their feature (we can't have two unstable features use the same
unstable attribute). Otherwise this uses all of the same infrastructure
as `#[rustc_align]`.
2025-09-09 21:54:54 +02:00

18 lines
579 B
Rust

#![feature(static_align)]
#![crate_type = "lib"]
#[rustc_align_static = 16] //~ ERROR malformed `rustc_align_static` attribute input
static S1: () = ();
#[rustc_align_static("hello")] //~ ERROR invalid alignment value: not an unsuffixed integer
static S2: () = ();
#[rustc_align_static(0)] //~ ERROR invalid alignment value: not a power of two
static S3: () = ();
#[repr(align(16))] //~ ERROR `#[repr(align(...))]` is not supported on static
static S4: () = ();
#[rustc_align_static(16)] //~ ERROR `#[rustc_align_static]` attribute cannot be used on structs
struct Struct1;