Rust errors / Attributes, macros and features
Rust compiler error · checked with rustc 1.99.0
Rust error E0589: invalid alignment value: not a power of two
What it meansThe value of N that was specified for repr(align(N)) was not a power of two, or was greater than 2^29.
What rustc prints
error[E0589]: invalid alignment value: not a power of two
--> main.rs:1:14
|
1 | #[repr(align(15))] // error: invalid `repr(align)` attribute: not a power of two
| ^^Real output of rustc 1.99.0 compiling the official example below (2021 edition). Your names and line numbers will differ; the first line is the part to match.
The compiler team's explanation
The value of N that was specified for repr(align(N)) was not a power of two, or was greater than 2^29.
Erroneous code example:
#[repr(align(15))] // error: invalid `repr(align)` attribute: not a power of two
enum Foo {
Bar(u64),
}From rustc --explain E0589 (1.99.0), part of the Rust project, MIT or Apache-2.0. Official page.
Related errors
Up next
Often hit nextE0658: is unstableA related error from the same family.Read it next →Did this answer your question?