Multiple alignments on functions (#![feature(fn_align)]
) #132464
Open
Description
opened on Nov 1, 2024
This code specifies two alignments, but applies none. A single align(256)
does work
#![feature(fn_align)]
#[repr(align(256), align(256))]
pub fn main() {
let ptr = main as *const u8;
println!("{ptr:?}");
assert_eq!(ptr.align_offset(256), 0);
}
CC: #82232
The culprit is this line here matching on slices of length 1:
rust/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Lines 418 to 420 in 145f9cf
It's a one line fix, but honestly this is trivially resolved with rust-lang/compiler-team#796 which I'm working on. I'll make it a separate PR at some point, but I'll assign myself since it makes sure changes conflict a little less :)
@rustbot claim
Activity