diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/codegen/aarch64-struct-align-128.rs | 150 | ||||
| -rw-r--r-- | tests/codegen/addr-of-mutate.rs | 6 | ||||
| -rw-r--r-- | tests/codegen/align-byval-vector.rs | 58 | ||||
| -rw-r--r-- | tests/codegen/align-byval.rs | 342 | ||||
| -rw-r--r-- | tests/codegen/array-map.rs | 1 | ||||
| -rw-r--r-- | tests/codegen/function-arguments-noopt.rs | 4 | ||||
| -rw-r--r-- | tests/codegen/function-arguments.rs | 4 | ||||
| -rw-r--r-- | tests/run-make/extern-fn-explicit-align/Makefile | 6 | ||||
| -rw-r--r-- | tests/run-make/extern-fn-explicit-align/test.c | 93 | ||||
| -rw-r--r-- | tests/run-make/extern-fn-explicit-align/test.rs | 89 | ||||
| -rw-r--r-- | tests/run-make/extern-fn-struct-passing-abi/test.c | 36 | ||||
| -rw-r--r-- | tests/run-make/extern-fn-struct-passing-abi/test.rs | 21 | ||||
| -rw-r--r-- | tests/ui/layout/debug.stderr | 36 | ||||
| -rw-r--r-- | tests/ui/layout/hexagon-enum.stderr | 20 | ||||
| -rw-r--r-- | tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr | 34 | ||||
| -rw-r--r-- | tests/ui/layout/issue-96185-overaligned-enum.stderr | 24 | ||||
| -rw-r--r-- | tests/ui/layout/thumb-enum.stderr | 20 | ||||
| -rw-r--r-- | tests/ui/layout/zero-sized-array-enum-niche.stderr | 26 |
18 files changed, 962 insertions, 8 deletions
diff --git a/tests/codegen/aarch64-struct-align-128.rs b/tests/codegen/aarch64-struct-align-128.rs new file mode 100644 index 00000000000..bf34717786d --- /dev/null +++ b/tests/codegen/aarch64-struct-align-128.rs @@ -0,0 +1,150 @@ +// Test that structs aligned to 128 bits are passed with the correct ABI on aarch64. + +// revisions:linux darwin windows +//[linux] compile-flags: --target aarch64-unknown-linux-gnu +//[darwin] compile-flags: --target aarch64-apple-darwin +//[windows] compile-flags: --target aarch64-pc-windows-msvc +//[linux] needs-llvm-components: aarch64 +//[darwin] needs-llvm-components: aarch64 +//[windows] needs-llvm-components: aarch64 + +#![feature(no_core, lang_items)] +#![crate_type = "lib"] +#![no_core] + +#[lang="sized"] +trait Sized { } +#[lang="freeze"] +trait Freeze { } +#[lang="copy"] +trait Copy { } + + + +// Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits. +#[repr(C)] +pub struct Align8 { + pub a: u64, + pub b: u64, +} + +// repr(transparent), so same as above. +#[repr(transparent)] +pub struct Transparent8 { + a: Align8 +} + +// Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits. +#[repr(C)] +pub struct Wrapped8 { + a: Align8, +} + +extern "C" { + // linux: declare void @test_8([2 x i64], [2 x i64], [2 x i64]) + // darwin: declare void @test_8([2 x i64], [2 x i64], [2 x i64]) + // windows: declare void @test_8([2 x i64], [2 x i64], [2 x i64]) + fn test_8(a: Align8, b: Transparent8, c: Wrapped8); +} + + + +// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. +// EXCEPT on Linux, where there's a special case to use its unadjusted alignment, +// making it the same as `Align8`, so it's be passed as `[i64 x 2]`. +#[repr(C)] +#[repr(align(16))] +pub struct Align16 { + pub a: u64, + pub b: u64, +} + +// repr(transparent), so same as above. +#[repr(transparent)] +pub struct Transparent16 { + a: Align16 +} + +// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. +// On Linux, the "unadjustedness" doesn't recurse into fields, so this is passed as `i128`. +#[repr(C)] +pub struct Wrapped16 { + pub a: Align16, +} + +extern "C" { + // linux: declare void @test_16([2 x i64], [2 x i64], i128) + // darwin: declare void @test_16(i128, i128, i128) + // windows: declare void @test_16(i128, i128, i128) + fn test_16(a: Align16, b: Transparent16, c: Wrapped16); +} + + + +// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. +#[repr(C)] +pub struct I128 { + pub a: i128, +} + +// repr(transparent), so same as above. +#[repr(transparent)] +pub struct TransparentI128 { + a: I128 +} + +// Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. +#[repr(C)] +pub struct WrappedI128 { + pub a: I128 +} + +extern "C" { + // linux: declare void @test_i128(i128, i128, i128) + // darwin: declare void @test_i128(i128, i128, i128) + // windows: declare void @test_i128(i128, i128, i128) + fn test_i128(a: I128, b: TransparentI128, c: WrappedI128); +} + + + +// Passed as `[2 x i64]`, since it's an aggregate with size <= 128 bits, align < 128 bits. +// Note that the Linux special case does not apply, because packing is not considered "adjustment". +#[repr(C)] +#[repr(packed)] +pub struct Packed { + pub a: i128, +} + +// repr(transparent), so same as above. +#[repr(transparent)] +pub struct TransparentPacked { + a: Packed +} + +// Passed as `[2 x i64]`, since it's an aggregate with size <= 128 bits, align < 128 bits. +#[repr(C)] +pub struct WrappedPacked { + pub a: Packed +} + +extern "C" { + // linux: declare void @test_packed([2 x i64], [2 x i64], [2 x i64]) + // darwin: declare void @test_packed([2 x i64], [2 x i64], [2 x i64]) + // windows: declare void @test_packed([2 x i64], [2 x i64], [2 x i64]) + fn test_packed(a: Packed, b: TransparentPacked, c: WrappedPacked); +} + + + +pub unsafe fn main( + a1: Align8, a2: Transparent8, a3: Wrapped8, + b1: Align16, b2: Transparent16, b3: Wrapped16, + c1: I128, c2: TransparentI128, c3: WrappedI128, + d1: Packed, d2: TransparentPacked, d3: WrappedPacked, +) { + test_8(a1, a2, a3); + test_16(b1, b2, b3); + test_i128(c1, c2, c3); + test_packed(d1, d2, d3); +} diff --git a/tests/codegen/addr-of-mutate.rs b/tests/codegen/addr-of-mutate.rs index bea1aad2352..6dfc1825015 100644 --- a/tests/codegen/addr-of-mutate.rs +++ b/tests/codegen/addr-of-mutate.rs @@ -6,7 +6,7 @@ // Test for the absence of `readonly` on the argument when it is mutated via `&raw const`. // See <https://github.com/rust-lang/rust/issues/111502>. -// CHECK: i8 @foo(ptr noalias nocapture noundef dereferenceable(128) %x) +// CHECK: i8 @foo(ptr noalias nocapture noundef align 1 dereferenceable(128) %x) #[no_mangle] pub fn foo(x: [u8; 128]) -> u8 { let ptr = core::ptr::addr_of!(x).cast_mut(); @@ -16,7 +16,7 @@ pub fn foo(x: [u8; 128]) -> u8 { x[0] } -// CHECK: i1 @second(ptr noalias nocapture noundef dereferenceable({{[0-9]+}}) %a_ptr_and_b) +// CHECK: i1 @second(ptr noalias nocapture noundef align {{[0-9]+}} dereferenceable({{[0-9]+}}) %a_ptr_and_b) #[no_mangle] pub unsafe fn second(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool { let b_bool_ptr = core::ptr::addr_of!(a_ptr_and_b.1.1).cast_mut(); @@ -25,7 +25,7 @@ pub unsafe fn second(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool { } // If going through a deref (and there are no other mutating accesses), then `readonly` is fine. -// CHECK: i1 @third(ptr noalias nocapture noundef readonly dereferenceable({{[0-9]+}}) %a_ptr_and_b) +// CHECK: i1 @third(ptr noalias nocapture noundef readonly align {{[0-9]+}} dereferenceable({{[0-9]+}}) %a_ptr_and_b) #[no_mangle] pub unsafe fn third(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool { let b_bool_ptr = core::ptr::addr_of!((*a_ptr_and_b.0).1).cast_mut(); diff --git a/tests/codegen/align-byval-vector.rs b/tests/codegen/align-byval-vector.rs new file mode 100644 index 00000000000..3c8be659671 --- /dev/null +++ b/tests/codegen/align-byval-vector.rs @@ -0,0 +1,58 @@ +// revisions:x86-linux x86-darwin + +//[x86-linux] compile-flags: --target i686-unknown-linux-gnu +//[x86-linux] needs-llvm-components: x86 +//[x86-darwin] compile-flags: --target i686-apple-darwin +//[x86-darwin] needs-llvm-components: x86 + +// Tests that aggregates containing vector types get their alignment increased to 16 on Darwin. + +#![feature(no_core, lang_items, repr_simd, simd_ffi)] +#![crate_type = "lib"] +#![no_std] +#![no_core] +#![allow(non_camel_case_types)] + +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} + +#[repr(simd)] +pub struct i32x4(i32, i32, i32, i32); + +#[repr(C)] +pub struct Foo { + a: i32x4, + b: i8, +} + +// This tests that we recursively check for vector types, not just at the top level. +#[repr(C)] +pub struct DoubleFoo { + one: Foo, + two: Foo, +} + +extern "C" { + // x86-linux: declare void @f({{.*}}byval(%Foo) align 4{{.*}}) + // x86-darwin: declare void @f({{.*}}byval(%Foo) align 16{{.*}}) + fn f(foo: Foo); + + // x86-linux: declare void @g({{.*}}byval(%DoubleFoo) align 4{{.*}}) + // x86-darwin: declare void @g({{.*}}byval(%DoubleFoo) align 16{{.*}}) + fn g(foo: DoubleFoo); +} + +pub fn main() { + unsafe { f(Foo { a: i32x4(1, 2, 3, 4), b: 0 }) } + + unsafe { + g(DoubleFoo { + one: Foo { a: i32x4(1, 2, 3, 4), b: 0 }, + two: Foo { a: i32x4(1, 2, 3, 4), b: 0 }, + }) + } +} diff --git a/tests/codegen/align-byval.rs b/tests/codegen/align-byval.rs new file mode 100644 index 00000000000..e2446e02ef4 --- /dev/null +++ b/tests/codegen/align-byval.rs @@ -0,0 +1,342 @@ +// ignore-tidy-linelength +// revisions:m68k wasm x86_64-linux x86_64-windows i686-linux i686-windows + +//[m68k] compile-flags: --target m68k-unknown-linux-gnu +//[m68k] needs-llvm-components: m68k +//[wasm] compile-flags: --target wasm32-unknown-emscripten +//[wasm] needs-llvm-components: webassembly +//[x86_64-linux] compile-flags: --target x86_64-unknown-linux-gnu +//[x86_64-linux] needs-llvm-components: x86 +//[x86_64-windows] compile-flags: --target x86_64-pc-windows-msvc +//[x86_64-windows] needs-llvm-components: x86 +//[i686-linux] compile-flags: --target i686-unknown-linux-gnu +//[i686-linux] needs-llvm-components: x86 +//[i686-windows] compile-flags: --target i686-pc-windows-msvc +//[i686-windows] needs-llvm-components: x86 + +// Tests that `byval` alignment is properly specified (#80127). +// The only targets that use `byval` are m68k, wasm, x86-64, and x86. +// Note also that Windows mandates a by-ref ABI here, so it does not use byval. + +#![feature(no_core, lang_items)] +#![crate_type = "lib"] +#![no_std] +#![no_core] + +#[lang="sized"] trait Sized { } +#[lang="freeze"] trait Freeze { } +#[lang="copy"] trait Copy { } + +impl Copy for i32 {} +impl Copy for i64 {} + +// This struct can be represented as a pair, so it exercises the OperandValue::Pair +// codepath in `codegen_argument`. +#[repr(C)] +pub struct NaturalAlign1 { + a: i8, + b: i8, +} + +// This struct cannot be represented as an immediate, so it exercises the OperandValue::Ref +// codepath in `codegen_argument`. +#[repr(C)] +pub struct NaturalAlign2 { + a: [i16; 16], + b: i16, +} + +#[repr(C)] +#[repr(align(4))] +pub struct ForceAlign4 { + a: [i8; 16], + b: i8, +} + +// On i686-windows, this is passed on stack using `byval` +#[repr(C)] +pub struct NaturalAlign8 { + a: i64, + b: i64, + c: i64 +} + +// On i686-windows, this is passed by reference (because alignment is >4 and requested/forced), +// even though it has the exact same layout as `NaturalAlign8`! +#[repr(C)] +#[repr(align(8))] +pub struct ForceAlign8 { + a: i64, + b: i64, + c: i64 +} + +// On i686-windows, this is passed on stack, because requested alignment is <=4. +#[repr(C)] +#[repr(align(4))] +pub struct LowerFA8 { + a: i64, + b: i64, + c: i64 +} + +// On i686-windows, this is passed by reference, because it contains a field with +// requested/forced alignment. +#[repr(C)] +pub struct WrappedFA8 { + a: ForceAlign8 +} + +// On i686-windows, this has the same ABI as ForceAlign8, i.e. passed by reference. +#[repr(transparent)] +pub struct TransparentFA8 { + _0: (), + a: ForceAlign8 +} + +#[repr(C)] +#[repr(align(16))] +pub struct ForceAlign16 { + a: [i32; 16], + b: i8 +} + +// CHECK-LABEL: @call_na1 +#[no_mangle] +pub unsafe fn call_na1(x: NaturalAlign1) { + // CHECK: start: + + // m68k: [[ALLOCA:%[a-z0-9+]]] = alloca { i8, i8 }, align 1 + // m68k: call void @natural_align_1({{.*}}byval({ i8, i8 }) align 1{{.*}} [[ALLOCA]]) + + // wasm: [[ALLOCA:%[a-z0-9+]]] = alloca { i8, i8 }, align 1 + // wasm: call void @natural_align_1({{.*}}byval({ i8, i8 }) align 1{{.*}} [[ALLOCA]]) + + // x86_64-linux: call void @natural_align_1(i16 + + // x86_64-windows: call void @natural_align_1(i16 + + // i686-linux: [[ALLOCA:%[a-z0-9+]]] = alloca { i8, i8 }, align 4 + // i686-linux: call void @natural_align_1({{.*}}byval({ i8, i8 }) align 4{{.*}} [[ALLOCA]]) + + // i686-windows: [[ALLOCA:%[a-z0-9+]]] = alloca { i8, i8 }, align 4 + // i686-windows: call void @natural_align_1({{.*}}byval({ i8, i8 }) align 4{{.*}} [[ALLOCA]]) + natural_align_1(x); +} + +// CHECK-LABEL: @call_na2 +#[no_mangle] +pub unsafe fn call_na2(x: NaturalAlign2) { + // CHECK: start: + + // m68k-NEXT: call void @natural_align_2 + // wasm-NEXT: call void @natural_align_2 + // x86_64-linux-NEXT: call void @natural_align_2 + // x86_64-windows-NEXT: call void @natural_align_2 + + // i686-linux: [[ALLOCA:%[0-9]+]] = alloca %NaturalAlign2, align 4 + // i686-linux: call void @natural_align_2({{.*}}byval(%NaturalAlign2) align 4{{.*}} [[ALLOCA]]) + + // i686-windows: [[ALLOCA:%[0-9]+]] = alloca %NaturalAlign2, align 4 + // i686-windows: call void @natural_align_2({{.*}}byval(%NaturalAlign2) align 4{{.*}} [[ALLOCA]]) + natural_align_2(x); +} + +// CHECK-LABEL: @call_fa4 +#[no_mangle] +pub unsafe fn call_fa4(x: ForceAlign4) { + // CHECK: start: + // CHECK-NEXT: call void @force_align_4 + force_align_4(x); +} + +// CHECK-LABEL: @call_na8 +#[no_mangle] +pub unsafe fn call_na8(x: NaturalAlign8) { + // CHECK: start: + // CHECK-NEXT: call void @natural_align_8 + natural_align_8(x); +} + +// CHECK-LABEL: @call_fa8 +#[no_mangle] +pub unsafe fn call_fa8(x: ForceAlign8) { + // CHECK: start: + // CHECK-NEXT: call void @force_align_8 + force_align_8(x); +} + +// CHECK-LABEL: @call_lfa8 +#[no_mangle] +pub unsafe fn call_lfa8(x: LowerFA8) { + // CHECK: start: + // CHECK-NEXT: call void @lower_fa8 + lower_fa8(x); +} + +// CHECK-LABEL: @call_wfa8 +#[no_mangle] +pub unsafe fn call_wfa8(x: WrappedFA8) { + // CHECK: start: + // CHECK-NEXT: call void @wrapped_fa8 + wrapped_fa8(x); +} + +// CHECK-LABEL: @call_tfa8 +#[no_mangle] +pub unsafe fn call_tfa8(x: TransparentFA8) { + // CHECK: start: + // CHECK-NEXT: call void @transparent_fa8 + transparent_fa8(x); +} + +// CHECK-LABEL: @call_fa16 +#[no_mangle] +pub unsafe fn call_fa16(x: ForceAlign16) { + // CHECK: start: + // CHECK-NEXT: call void @force_align_16 + force_align_16(x); +} + +extern "C" { + // m68k: declare void @natural_align_1({{.*}}byval({ i8, i8 }) align 1{{.*}}) + + // wasm: declare void @natural_align_1({{.*}}byval({ i8, i8 }) align 1{{.*}}) + + // x86_64-linux: declare void @natural_align_1(i16) + + // x86_64-windows: declare void @natural_align_1(i16) + + // i686-linux: declare void @natural_align_1({{.*}}byval({ i8, i8 }) align 4{{.*}}) + + // i686-windows: declare void @natural_align_1({{.*}}byval({ i8, i8 }) align 4{{.*}}) + fn natural_align_1(x: NaturalAlign1); + + // m68k: declare void @natural_align_2({{.*}}byval(%NaturalAlign2) align 2{{.*}}) + + // wasm: declare void @natural_align_2({{.*}}byval(%NaturalAlign2) align 2{{.*}}) + + // x86_64-linux: declare void @natural_align_2({{.*}}byval(%NaturalAlign2) align 2{{.*}}) + + // x86_64-windows: declare void @natural_align_2( + // x86_64-windows-NOT: byval + // x86_64-windows-SAME: align 2{{.*}}) + + // i686-linux: declare void @natural_align_2({{.*}}byval(%NaturalAlign2) align 4{{.*}}) + + // i686-windows: declare void @natural_align_2({{.*}}byval(%NaturalAlign2) align 4{{.*}}) + fn natural_align_2(x: NaturalAlign2); + + // m68k: declare void @force_align_4({{.*}}byval(%ForceAlign4) align 4{{.*}}) + + // wasm: declare void @force_align_4({{.*}}byval(%ForceAlign4) align 4{{.*}}) + + // x86_64-linux: declare void @force_align_4({{.*}}byval(%ForceAlign4) align 4{{.*}}) + + // x86_64-windows: declare void @force_align_4( + // x86_64-windows-NOT: byval + // x86_64-windows-SAME: align 4{{.*}}) + + // i686-linux: declare void @force_align_4({{.*}}byval(%ForceAlign4) align 4{{.*}}) + + // i686-windows: declare void @force_align_4({{.*}}byval(%ForceAlign4) align 4{{.*}}) + fn force_align_4(x: ForceAlign4); + + // m68k: declare void @natural_align_8({{.*}}byval(%NaturalAlign8) align 4{{.*}}) + + // wasm: declare void @natural_align_8({{.*}}byval(%NaturalAlign8) align 8{{.*}}) + + // x86_64-linux: declare void @natural_align_8({{.*}}byval(%NaturalAlign8) align 8{{.*}}) + + // x86_64-windows: declare void @natural_align_8( + // x86_64-windows-NOT: byval + // x86_64-windows-SAME: align 8{{.*}}) + + // i686-linux: declare void @natural_align_8({{.*}}byval(%NaturalAlign8) align 4{{.*}}) + + // i686-windows: declare void @natural_align_8({{.*}}byval(%NaturalAlign8) align 4{{.*}}) + fn natural_align_8(x: NaturalAlign8); + + // m68k: declare void @force_align_8({{.*}}byval(%ForceAlign8) align 8{{.*}}) + + // wasm: declare void @force_align_8({{.*}}byval(%ForceAlign8) align 8{{.*}}) + + // x86_64-linux: declare void @force_align_8({{.*}}byval(%ForceAlign8) align 8{{.*}}) + + // x86_64-windows: declare void @force_align_8( + // x86_64-windows-NOT: byval + // x86_64-windows-SAME: align 8{{.*}}) + + // i686-linux: declare void @force_align_8({{.*}}byval(%ForceAlign8) align 4{{.*}}) + + // i686-windows: declare void @force_align_8( + // i686-windows-NOT: byval + // i686-windows-SAME: align 8{{.*}}) + fn force_align_8(x: ForceAlign8); + + // m68k: declare void @lower_fa8({{.*}}byval(%LowerFA8) align 4{{.*}}) + + // wasm: declare void @lower_fa8({{.*}}byval(%LowerFA8) align 8{{.*}}) + + // x86_64-linux: declare void @lower_fa8({{.*}}byval(%LowerFA8) align 8{{.*}}) + + // x86_64-windows: declare void @lower_fa8( + // x86_64-windows-NOT: byval + // x86_64-windows-SAME: align 8{{.*}}) + + // i686-linux: declare void @lower_fa8({{.*}}byval(%LowerFA8) align 4{{.*}}) + + // i686-windows: declare void @lower_fa8({{.*}}byval(%LowerFA8) align 4{{.*}}) + fn lower_fa8(x: LowerFA8); + + // m68k: declare void @wrapped_fa8({{.*}}byval(%WrappedFA8) align 8{{.*}}) + + // wasm: declare void @wrapped_fa8({{.*}}byval(%WrappedFA8) align 8{{.*}}) + + // x86_64-linux: declare void @wrapped_fa8({{.*}}byval(%WrappedFA8) align 8{{.*}}) + + // x86_64-windows: declare void @wrapped_fa8( + // x86_64-windows-NOT: byval + // x86_64-windows-SAME: align 8{{.*}}) + + // i686-linux: declare void @wrapped_fa8({{.*}}byval(%WrappedFA8) align 4{{.*}}) + + // i686-windows: declare void @wrapped_fa8( + // i686-windows-NOT: byval + // i686-windows-SAME: align 8{{.*}}) + fn wrapped_fa8(x: WrappedFA8); + + // m68k: declare void @transparent_fa8({{.*}}byval(%TransparentFA8) align 8{{.*}}) + + // wasm: declare void @transparent_fa8({{.*}}byval(%TransparentFA8) align 8{{.*}}) + + // x86_64-linux: declare void @transparent_fa8({{.*}}byval(%TransparentFA8) align 8{{.*}}) + + // x86_64-windows: declare void @transparent_fa8( + // x86_64-windows-NOT: byval + // x86_64-windows-SAME: align 8{{.*}}) + + // i686-linux: declare void @transparent_fa8({{.*}}byval(%TransparentFA8) align 4{{.*}}) + + // i686-windows: declare void @transparent_fa8( + // i686-windows-NOT: byval + // i686-windows-SAME: align 8{{.*}}) + fn transparent_fa8(x: TransparentFA8); + + // m68k: declare void @force_align_16({{.*}}byval(%ForceAlign16) align 16{{.*}}) + + // wasm: declare void @force_align_16({{.*}}byval(%ForceAlign16) align 16{{.*}}) + + // x86_64-linux: declare void @force_align_16({{.*}}byval(%ForceAlign16) align 16{{.*}}) + + // x86_64-windows: declare void @force_align_16( + // x86_64-windows-NOT: byval + // x86_64-windows-SAME: align 16{{.*}}) + + // i686-linux: declare void @force_align_16({{.*}}byval(%ForceAlign16) align 4{{.*}}) + + // i686-windows: declare void @force_align_16( + // i686-windows-NOT: byval + // i686-windows-SAME: align 16{{.*}}) + fn force_align_16(x: ForceAlign16); +} diff --git a/tests/codegen/array-map.rs b/tests/codegen/array-map.rs index 24f3f43d078..4d218e6a951 100644 --- a/tests/codegen/array-map.rs +++ b/tests/codegen/array-map.rs @@ -30,7 +30,6 @@ pub fn short_integer_map(x: [u32; 8]) -> [u32; 8] { pub fn long_integer_map(x: [u32; 512]) -> [u32; 512] { // CHECK: start: // CHECK-NEXT: alloca [512 x i32] - // CHECK-NEXT: alloca %"core::mem::manually_drop::ManuallyDrop<[u32; 512]>" // CHECK-NOT: alloca // CHECK: mul <{{[0-9]+}} x i32> // CHECK: add <{{[0-9]+}} x i32> diff --git a/tests/codegen/function-arguments-noopt.rs b/tests/codegen/function-arguments-noopt.rs index 35f31eba3b1..f99cc8fb415 100644 --- a/tests/codegen/function-arguments-noopt.rs +++ b/tests/codegen/function-arguments-noopt.rs @@ -42,7 +42,7 @@ pub fn borrow_call(x: &i32, f: fn(&i32) -> &i32) -> &i32 { f(x) } -// CHECK: void @struct_({{%S\*|ptr}} sret(%S){{( %_0)?}}, {{%S\*|ptr}} %x) +// CHECK: void @struct_({{%S\*|ptr}} sret(%S) align 4{{( %_0)?}}, {{%S\*|ptr}} align 4 %x) #[no_mangle] pub fn struct_(x: S) -> S { x @@ -51,7 +51,7 @@ pub fn struct_(x: S) -> S { // CHECK-LABEL: @struct_call #[no_mangle] pub fn struct_call(x: S, f: fn(S) -> S) -> S { - // CHECK: call void %f({{%S\*|ptr}} sret(%S){{( %_0)?}}, {{%S\*|ptr}} %{{.+}}) + // CHECK: call void %f({{%S\*|ptr}} sret(%S) align 4{{( %_0)?}}, {{%S\*|ptr}} align 4 %{{.+}}) f(x) } diff --git a/tests/codegen/function-arguments.rs b/tests/codegen/function-arguments.rs index ccf4a5de327..2f047f10311 100644 --- a/tests/codegen/function-arguments.rs +++ b/tests/codegen/function-arguments.rs @@ -142,7 +142,7 @@ pub fn mutable_notunpin_borrow(_: &mut NotUnpin) { pub fn notunpin_borrow(_: &NotUnpin) { } -// CHECK: @indirect_struct({{%S\*|ptr}} noalias nocapture noundef readonly dereferenceable(32) %_1) +// CHECK: @indirect_struct({{%S\*|ptr}} noalias nocapture noundef readonly align 4 dereferenceable(32) %_1) #[no_mangle] pub fn indirect_struct(_: S) { } @@ -188,7 +188,7 @@ pub fn notunpin_box(x: Box<NotUnpin>) -> Box<NotUnpin> { x } -// CHECK: @struct_return({{%S\*|ptr}} noalias nocapture noundef sret(%S) dereferenceable(32){{( %_0)?}}) +// CHECK: @struct_return({{%S\*|ptr}} noalias nocapture noundef sret(%S) align 4 dereferenceable(32){{( %_0)?}}) #[no_mangle] pub fn struct_return() -> S { S { diff --git a/tests/run-make/extern-fn-explicit-align/Makefile b/tests/run-make/extern-fn-explicit-align/Makefile new file mode 100644 index 00000000000..3cbbf383996 --- /dev/null +++ b/tests/run-make/extern-fn-explicit-align/Makefile @@ -0,0 +1,6 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-explicit-align/test.c b/tests/run-make/extern-fn-explicit-align/test.c new file mode 100644 index 00000000000..a3db3442aaf --- /dev/null +++ b/tests/run-make/extern-fn-explicit-align/test.c @@ -0,0 +1,93 @@ +#include <assert.h> +#include <stdbool.h> +#include <stdint.h> +#include <string.h> + +struct BoolAndU32 +{ + bool a; + uint32_t b; +}; + +#ifdef _MSC_VER +__declspec(align(16)) +struct TwoU64s +{ + uint64_t a; + uint64_t b; +}; +#else +struct __attribute__((aligned(16))) TwoU64s +{ + uint64_t a; + uint64_t b; +}; +#endif + +struct WrappedU64s +{ + struct TwoU64s a; +}; + +#ifdef _MSC_VER +__declspec(align(1)) +struct LowerAlign +{ + uint64_t a; + uint64_t b; +}; +#else +struct __attribute__((aligned(1))) LowerAlign +{ + uint64_t a; + uint64_t b; +}; +#endif + +#pragma pack(push, 1) +struct Packed +{ + uint64_t a; + uint64_t b; +}; +#pragma pack(pop) + +int32_t many_args( + void *a, + void *b, + const char *c, + uint64_t d, + bool e, + struct BoolAndU32 f, + void *g, + struct TwoU64s h, + void *i, + struct WrappedU64s j, + void *k, + struct LowerAlign l, + void *m, + struct Packed n, + const char *o) +{ + assert(!a); + assert(!b); + assert(!c); + assert(d == 42); + assert(e); + assert(f.a); + assert(f.b == 1337); + assert(!g); + assert(h.a == 1); + assert(h.b == 2); + assert(!i); + assert(j.a.a == 3); + assert(j.a.b == 4); + assert(!k); + assert(l.a == 5); + assert(l.b == 6); + assert(!m); + assert(n.a == 7); + assert(n.b == 8); + assert(strcmp(o, "Hello world") == 0); + return 0; +} diff --git a/tests/run-make/extern-fn-explicit-align/test.rs b/tests/run-make/extern-fn-explicit-align/test.rs new file mode 100644 index 00000000000..846622de3cd --- /dev/null +++ b/tests/run-make/extern-fn-explicit-align/test.rs @@ -0,0 +1,89 @@ +// Issue #80127: Passing structs via FFI should work with explicit alignment. + +use std::ffi::{CStr, c_char}; +use std::ptr::null_mut; + +#[repr(C)] +pub struct BoolAndU32 { + pub a: bool, + pub b: u32, +} + +#[repr(C)] +#[repr(align(16))] +pub struct TwoU64s { + pub a: u64, + pub b: u64, +} + +#[repr(C)] +pub struct WrappedU64s { + pub a: TwoU64s +} + +#[repr(C)] +// Even though requesting align 1 can never change the alignment, it still affects the ABI +// on some platforms like i686-windows. +#[repr(align(1))] +pub struct LowerAlign { + pub a: u64, + pub b: u64, +} + +#[repr(C)] +#[repr(packed)] +pub struct Packed { + pub a: u64, + pub b: u64, +} + +#[link(name = "test", kind = "static")] +extern "C" { + fn many_args( + a: *mut (), + b: *mut (), + c: *const c_char, + d: u64, + e: bool, + f: BoolAndU32, + g: *mut (), + h: TwoU64s, + i: *mut (), + j: WrappedU64s, + k: *mut (), + l: LowerAlign, + m: *mut (), + n: Packed, + o: *const c_char, + ) -> i32; +} + +const STRING: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Hello world\0") }; + +fn main() { + let bool_and_u32 = BoolAndU32 { a: true, b: 1337 }; + let two_u64s = TwoU64s { a: 1, b: 2 }; + let wrapped = WrappedU64s { a: TwoU64s { a: 3, b: 4 } }; + let lower = LowerAlign { a: 5, b: 6 }; + let packed = Packed { a: 7, b: 8 }; + let string = STRING; + unsafe { + many_args( + null_mut(), + null_mut(), + null_mut(), + 42, + true, + bool_and_u32, + null_mut(), + two_u64s, + null_mut(), + wrapped, + null_mut(), + lower, + null_mut(), + packed, + string.as_ptr(), + ); + } +} diff --git a/tests/run-make/extern-fn-struct-passing-abi/test.c b/tests/run-make/extern-fn-struct-passing-abi/test.c index 136b07129e1..2cff776d86c 100644 --- a/tests/run-make/extern-fn-struct-passing-abi/test.c +++ b/tests/run-make/extern-fn-struct-passing-abi/test.c @@ -28,6 +28,14 @@ struct Huge { int32_t e; }; +struct Huge64 { + int64_t a; + int64_t b; + int64_t c; + int64_t d; + int64_t e; +}; + struct FloatPoint { double x; double y; @@ -152,6 +160,21 @@ void byval_rect_with_many_huge(struct Huge a, struct Huge b, struct Huge c, assert(g.d == 420); } +// System V x86_64 ABI: +// a, b, d, e, f should be byval pointer (on the stack) +// g passed via register (fixes #41375) +// +// i686-windows ABI: +// a, b, d, e, f, g should be byval pointer +void byval_rect_with_many_huge64(struct Huge64 a, struct Huge64 b, struct Huge64 c, + struct Huge64 d, struct Huge64 e, struct Huge64 f, + struct Rect g) { + assert(g.a == 1234); + assert(g.b == 4567); + assert(g.c == 7890); + assert(g.d == 4209); +} + // System V x86_64 & Win64 ABI: // a, b should be in registers // s should be split across 2 integer registers @@ -279,6 +302,19 @@ struct Huge huge_struct(struct Huge s) { return s; } +// System V x86_64 & i686-windows ABI: +// s should be byval pointer +// return should in a hidden sret pointer +struct Huge64 huge64_struct(struct Huge64 s) { + assert(s.a == 1234); + assert(s.b == 1335); + assert(s.c == 1436); + assert(s.d == 1537); + assert(s.e == 1638); + + return s; +} + // System V x86_64 ABI: // p should be in registers // return should be in registers diff --git a/tests/run-make/extern-fn-struct-passing-abi/test.rs b/tests/run-make/extern-fn-struct-passing-abi/test.rs index afe0f52ef0b..99e079f98a8 100644 --- a/tests/run-make/extern-fn-struct-passing-abi/test.rs +++ b/tests/run-make/extern-fn-struct-passing-abi/test.rs @@ -38,6 +38,16 @@ struct Huge { #[derive(Clone, Copy, Debug, PartialEq)] #[repr(C)] +struct Huge64 { + a: i64, + b: i64, + c: i64, + d: i64, + e: i64, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] struct FloatPoint { x: f64, y: f64, @@ -79,6 +89,12 @@ extern "C" { fn byval_rect_with_many_huge(a: Huge, b: Huge, c: Huge, d: Huge, e: Huge, f: Huge, g: Rect); + fn byval_rect_with_many_huge64( + a: Huge64, b: Huge64, c: Huge64, + d: Huge64, e: Huge64, f: Huge64, + g: Rect, + ); + fn split_rect(a: i32, b: i32, s: Rect); fn split_rect_floats(a: f32, b: f32, s: FloatRect); @@ -95,6 +111,8 @@ extern "C" { fn huge_struct(s: Huge) -> Huge; + fn huge64_struct(s: Huge64) -> Huge64; + fn float_point(p: FloatPoint) -> FloatPoint; fn float_one(f: FloatOne) -> FloatOne; @@ -107,6 +125,7 @@ fn main() { let t = BiggerRect { s: s, a: 27834, b: 7657 }; let u = FloatRect { a: 3489, b: 3490, c: 8. }; let v = Huge { a: 5647, b: 5648, c: 5649, d: 5650, e: 5651 }; + let w = Huge64 { a: 1234, b: 1335, c: 1436, d: 1537, e: 1638 }; let p = FloatPoint { x: 5., y: -3. }; let f1 = FloatOne { x: 7. }; let i = IntOdd { a: 1, b: 2, c: 3 }; @@ -117,12 +136,14 @@ fn main() { byval_rect_floats(1., 2., 3., 4., 5., 6., 7., s, u); byval_rect_with_float(1, 2, 3.0, 4, 5, 6, s); byval_rect_with_many_huge(v, v, v, v, v, v, Rect { a: 123, b: 456, c: 789, d: 420 }); + byval_rect_with_many_huge64(w, w, w, w, w, w, Rect { a: 1234, b: 4567, c: 7890, d: 4209 }); split_rect(1, 2, s); split_rect_floats(1., 2., u); split_rect_with_floats(1, 2, 3.0, 4, 5.0, 6, s); split_and_byval_rect(1, 2, 3, s, s); split_rect(1, 2, s); assert_eq!(huge_struct(v), v); + assert_eq!(huge64_struct(w), w); assert_eq!(split_ret_byval_struct(1, 2, s), s); assert_eq!(sret_byval_struct(1, 2, 3, 4, s), t); assert_eq!(sret_split_struct(1, 2, s), t); diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr index b9fa1b299e9..eeffb3c5f64 100644 --- a/tests/ui/layout/debug.stderr +++ b/tests/ui/layout/debug.stderr @@ -53,6 +53,8 @@ error: layout_of(E) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, Layout { size: Size(12 bytes), @@ -77,9 +79,13 @@ error: layout_of(E) = Layout { variants: Single { index: 1, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/debug.rs:7:1 | @@ -124,6 +130,8 @@ error: layout_of(S) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/debug.rs:10:1 | @@ -146,6 +154,8 @@ error: layout_of(U) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/debug.rs:13:1 | @@ -237,6 +247,8 @@ error: layout_of(std::result::Result<i32, i32>) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), }, Layout { size: Size(8 bytes), @@ -272,9 +284,13 @@ error: layout_of(std::result::Result<i32, i32>) = Layout { variants: Single { index: 1, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/debug.rs:16:1 | @@ -301,6 +317,8 @@ error: layout_of(i32) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/debug.rs:19:1 | @@ -323,6 +341,8 @@ error: layout_of(V) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(2 bytes), } --> $DIR/debug.rs:22:1 | @@ -345,6 +365,8 @@ error: layout_of(W) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(2 bytes), } --> $DIR/debug.rs:28:1 | @@ -367,6 +389,8 @@ error: layout_of(Y) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(2 bytes), } --> $DIR/debug.rs:34:1 | @@ -389,6 +413,8 @@ error: layout_of(P1) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/debug.rs:41:1 | @@ -411,6 +437,8 @@ error: layout_of(P2) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/debug.rs:45:1 | @@ -433,6 +461,8 @@ error: layout_of(P3) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/debug.rs:53:1 | @@ -455,6 +485,8 @@ error: layout_of(P4) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/debug.rs:57:1 | @@ -482,6 +514,8 @@ error: layout_of(P5) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/debug.rs:61:1 | @@ -509,6 +543,8 @@ error: layout_of(std::mem::MaybeUninit<u8>) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/debug.rs:64:1 | diff --git a/tests/ui/layout/hexagon-enum.stderr b/tests/ui/layout/hexagon-enum.stderr index d850dd69c96..a2ad4a1ab58 100644 --- a/tests/ui/layout/hexagon-enum.stderr +++ b/tests/ui/layout/hexagon-enum.stderr @@ -59,9 +59,13 @@ error: layout_of(A) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/hexagon-enum.rs:16:1 | @@ -129,9 +133,13 @@ error: layout_of(B) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/hexagon-enum.rs:20:1 | @@ -199,9 +207,13 @@ error: layout_of(C) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(2 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(2 bytes), } --> $DIR/hexagon-enum.rs:24:1 | @@ -269,9 +281,13 @@ error: layout_of(P) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/hexagon-enum.rs:28:1 | @@ -339,9 +355,13 @@ error: layout_of(T) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/hexagon-enum.rs:34:1 | diff --git a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr index 8c7c915350f..d3ba1a295b1 100644 --- a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr +++ b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr @@ -81,6 +81,8 @@ error: layout_of(MissingPayloadField) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, Layout { size: Size(1 bytes), @@ -99,9 +101,13 @@ error: layout_of(MissingPayloadField) = Layout { variants: Single { index: 1, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:16:1 | @@ -193,6 +199,8 @@ error: layout_of(CommonPayloadField) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, Layout { size: Size(2 bytes), @@ -228,9 +236,13 @@ error: layout_of(CommonPayloadField) = Layout { variants: Single { index: 1, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:25:1 | @@ -320,6 +332,8 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, Layout { size: Size(2 bytes), @@ -354,9 +368,13 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { variants: Single { index: 1, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:33:1 | @@ -462,6 +480,8 @@ error: layout_of(NicheFirst) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, Layout { size: Size(0 bytes), @@ -480,6 +500,8 @@ error: layout_of(NicheFirst) = Layout { variants: Single { index: 1, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, Layout { size: Size(0 bytes), @@ -498,9 +520,13 @@ error: layout_of(NicheFirst) = Layout { variants: Single { index: 2, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:41:1 | @@ -606,6 +632,8 @@ error: layout_of(NicheSecond) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, Layout { size: Size(0 bytes), @@ -624,6 +652,8 @@ error: layout_of(NicheSecond) = Layout { variants: Single { index: 1, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, Layout { size: Size(0 bytes), @@ -642,9 +672,13 @@ error: layout_of(NicheSecond) = Layout { variants: Single { index: 2, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:50:1 | diff --git a/tests/ui/layout/issue-96185-overaligned-enum.stderr b/tests/ui/layout/issue-96185-overaligned-enum.stderr index de6177c8dfc..c539eb453d9 100644 --- a/tests/ui/layout/issue-96185-overaligned-enum.stderr +++ b/tests/ui/layout/issue-96185-overaligned-enum.stderr @@ -53,6 +53,10 @@ error: layout_of(Aligned1) = Layout { variants: Single { index: 0, }, + max_repr_align: Some( + Align(8 bytes), + ), + unadjusted_abi_align: Align(1 bytes), }, Layout { size: Size(8 bytes), @@ -71,9 +75,17 @@ error: layout_of(Aligned1) = Layout { variants: Single { index: 1, }, + max_repr_align: Some( + Align(8 bytes), + ), + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: Some( + Align(8 bytes), + ), + unadjusted_abi_align: Align(1 bytes), } --> $DIR/issue-96185-overaligned-enum.rs:8:1 | @@ -141,6 +153,10 @@ error: layout_of(Aligned2) = Layout { variants: Single { index: 0, }, + max_repr_align: Some( + Align(1 bytes), + ), + unadjusted_abi_align: Align(1 bytes), }, Layout { size: Size(1 bytes), @@ -159,9 +175,17 @@ error: layout_of(Aligned2) = Layout { variants: Single { index: 1, }, + max_repr_align: Some( + Align(1 bytes), + ), + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: Some( + Align(1 bytes), + ), + unadjusted_abi_align: Align(1 bytes), } --> $DIR/issue-96185-overaligned-enum.rs:16:1 | diff --git a/tests/ui/layout/thumb-enum.stderr b/tests/ui/layout/thumb-enum.stderr index 227bd950b66..6f6ab498206 100644 --- a/tests/ui/layout/thumb-enum.stderr +++ b/tests/ui/layout/thumb-enum.stderr @@ -59,9 +59,13 @@ error: layout_of(A) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/thumb-enum.rs:16:1 | @@ -129,9 +133,13 @@ error: layout_of(B) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), } --> $DIR/thumb-enum.rs:20:1 | @@ -199,9 +207,13 @@ error: layout_of(C) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(2 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(2 bytes), } --> $DIR/thumb-enum.rs:24:1 | @@ -269,9 +281,13 @@ error: layout_of(P) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/thumb-enum.rs:28:1 | @@ -339,9 +355,13 @@ error: layout_of(T) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/thumb-enum.rs:34:1 | diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr index a3e82070e0f..df9f1cc8d10 100644 --- a/tests/ui/layout/zero-sized-array-enum-niche.stderr +++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr @@ -57,6 +57,8 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), }, Layout { size: Size(2 bytes), @@ -88,9 +90,13 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout { variants: Single { index: 1, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/zero-sized-array-enum-niche.rs:13:1 | @@ -156,6 +162,8 @@ error: layout_of(MultipleAlignments) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(2 bytes), }, Layout { size: Size(4 bytes), @@ -178,6 +186,8 @@ error: layout_of(MultipleAlignments) = Layout { variants: Single { index: 1, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), }, Layout { size: Size(2 bytes), @@ -209,9 +219,13 @@ error: layout_of(MultipleAlignments) = Layout { variants: Single { index: 2, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/zero-sized-array-enum-niche.rs:21:1 | @@ -277,6 +291,8 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) = variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), }, Layout { size: Size(3 bytes), @@ -308,9 +324,13 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) = variants: Single { index: 1, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/zero-sized-array-enum-niche.rs:37:1 | @@ -380,6 +400,8 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout { variants: Single { index: 0, }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), }, Layout { size: Size(2 bytes), @@ -411,9 +433,13 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout { variants: Single { index: 1, }, + max_repr_align: None, + unadjusted_abi_align: Align(1 bytes), }, ], }, + max_repr_align: None, + unadjusted_abi_align: Align(4 bytes), } --> $DIR/zero-sized-array-enum-niche.rs:44:1 | |
