diff options
| author | bors <bors@rust-lang.org> | 2025-02-21 00:16:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-21 00:16:10 +0000 |
| commit | a18bd8acfc32dbfbbe150cd52eecf24e67fb69b6 (patch) | |
| tree | 92d2257f931521792d2f2b51a779776fe8a3d3ae /tests/codegen | |
| parent | f04bbc60f8c353ee5ba0677bc583ac4a88b2c180 (diff) | |
| parent | 4d479f9c804b97c9a0aa82166872746c9941d78d (diff) | |
| download | rust-a18bd8acfc32dbfbbe150cd52eecf24e67fb69b6.tar.gz rust-a18bd8acfc32dbfbbe150cd52eecf24e67fb69b6.zip | |
Auto merge of #137346 - workingjubilee:rollup-sxu05ms, r=workingjubilee
Rollup of 12 pull requests Successful merges: - #131651 (Create a generic AVR target: avr-none) - #134340 (Stabilize `num_midpoint_signed` feature) - #136473 (infer linker flavor by linker name if it's sufficiently specific) - #136608 (Pass through of target features to llvm-bitcode-linker and handling them) - #136985 (Do not ignore uninhabited types for function-call ABI purposes. (Remove BackendRepr::Uninhabited)) - #137270 (Fix `*-win7-windows-msvc` target since 26eeac1a1e9fe46ffd80dd0d3dafdd2c2a644306) - #137312 (Update references to cc_detect.rs) - #137318 (Workaround Cranelift not yet properly supporting vectors smaller than 128bit) - #137322 (Update docs for default features of wasm targets) - #137324 (Make x86 QNX target name consistent with other Rust targets) - #137338 (skip submodule updating logics on tarballs) - #137340 (Add a notice about missing GCC sources into source tarballs) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/asm/avr-clobbers.rs | 2 | ||||
| -rw-r--r-- | tests/codegen/avr/avr-func-addrspace.rs | 2 | ||||
| -rw-r--r-- | tests/codegen/uninhabited-transparent-return-abi.rs | 44 |
3 files changed, 46 insertions, 2 deletions
diff --git a/tests/codegen/asm/avr-clobbers.rs b/tests/codegen/asm/avr-clobbers.rs index 56218cd7bcf..9451127bf04 100644 --- a/tests/codegen/asm/avr-clobbers.rs +++ b/tests/codegen/asm/avr-clobbers.rs @@ -1,6 +1,6 @@ //@ add-core-stubs //@ assembly-output: emit-asm -//@ compile-flags: --target avr-unknown-gnu-atmega328 +//@ compile-flags: --target avr-none -C target-cpu=atmega328p //@ needs-llvm-components: avr #![crate_type = "rlib"] diff --git a/tests/codegen/avr/avr-func-addrspace.rs b/tests/codegen/avr/avr-func-addrspace.rs index ed8acccb1ad..2ec7c86b5f4 100644 --- a/tests/codegen/avr/avr-func-addrspace.rs +++ b/tests/codegen/avr/avr-func-addrspace.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Copt-level=3 --target=avr-unknown-gnu-atmega328 --crate-type=rlib -C panic=abort +//@ compile-flags: -Copt-level=3 --target=avr-none -C target-cpu=atmega328p --crate-type=rlib -C panic=abort //@ needs-llvm-components: avr // This test validates that function pointers can be stored in global variables diff --git a/tests/codegen/uninhabited-transparent-return-abi.rs b/tests/codegen/uninhabited-transparent-return-abi.rs new file mode 100644 index 00000000000..6e8b1683163 --- /dev/null +++ b/tests/codegen/uninhabited-transparent-return-abi.rs @@ -0,0 +1,44 @@ +//@ compile-flags: -Copt-level=3 + +// See https://github.com/rust-lang/rust/issues/135802 + +#![crate_type = "lib"] + +enum Void {} + +// Should be ABI-compatible with T, but wasn't prior to the PR adding this test. +#[repr(transparent)] +struct NoReturn<T>(T, Void); + +// Returned by invisible reference (in most ABIs) +#[allow(dead_code)] +struct Large(u64, u64, u64); + +extern "Rust" { + fn opaque() -> NoReturn<Large>; + fn opaque_with_arg(rsi: u32) -> NoReturn<Large>; +} + +// CHECK-LABEL: @test_uninhabited_ret_by_ref +#[no_mangle] +pub fn test_uninhabited_ret_by_ref() { + // CHECK: %_1 = alloca [24 x i8], align {{8|4}} + // CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %_1) + // CHECK-NEXT: call void @opaque(ptr noalias nocapture noundef nonnull sret([24 x i8]) align {{8|4}} dereferenceable(24) %_1) #2 + // CHECK-NEXT: unreachable + unsafe { + opaque(); + } +} + +// CHECK-LABEL: @test_uninhabited_ret_by_ref_with_arg +#[no_mangle] +pub fn test_uninhabited_ret_by_ref_with_arg(rsi: u32) { + // CHECK: %_2 = alloca [24 x i8], align {{8|4}} + // CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %_2) + // CHECK-NEXT: call void @opaque_with_arg(ptr noalias nocapture noundef nonnull sret([24 x i8]) align {{8|4}} dereferenceable(24) %_2, i32 noundef %rsi) #2 + // CHECK-NEXT: unreachable + unsafe { + opaque_with_arg(rsi); + } +} |
