fix multiple #[repr(align(N))]
on functions
This commit is contained in:
parent
5961e5ba3d
commit
a6dcd519f3
2 changed files with 21 additions and 1 deletions
|
@ -114,7 +114,8 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
AttributeKind::Repr(reprs) => {
|
||||
codegen_fn_attrs.alignment = reprs
|
||||
.iter()
|
||||
.find_map(|(r, _)| if let ReprAlign(x) = r { Some(*x) } else { None });
|
||||
.filter_map(|(r, _)| if let ReprAlign(x) = r { Some(*x) } else { None })
|
||||
.max();
|
||||
}
|
||||
|
||||
_ => {}
|
||||
|
|
|
@ -47,3 +47,22 @@ impl T for () {}
|
|||
pub fn foo() {
|
||||
().trait_method();
|
||||
}
|
||||
|
||||
// CHECK-LABEL: align_specified_twice_1
|
||||
// CHECK-SAME: align 64
|
||||
#[no_mangle]
|
||||
#[repr(align(32), align(64))]
|
||||
pub fn align_specified_twice_1() {}
|
||||
|
||||
// CHECK-LABEL: align_specified_twice_2
|
||||
// CHECK-SAME: align 128
|
||||
#[no_mangle]
|
||||
#[repr(align(128), align(32))]
|
||||
pub fn align_specified_twice_2() {}
|
||||
|
||||
// CHECK-LABEL: align_specified_twice_3
|
||||
// CHECK-SAME: align 256
|
||||
#[no_mangle]
|
||||
#[repr(align(32))]
|
||||
#[repr(align(256))]
|
||||
pub fn align_specified_twice_3() {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue