rust/tests/codegen/repr/transparent-opaque-ptr.rs
Alex Crichton c049cc17f3 Remove the wasm32-wasi target from rustc
This commit is the final step in the journey of renaming the historical
`wasm32-wasi` target in the Rust compiler to `wasm32-wasip1`. Various
steps in this journey so far have been:

* 2023-04-03: rust-lang/compiler-team#607 - initial proposal for this rename
* 2024-11-27: rust-lang/compiler-team#695 - amended schedule/procedure for rename
* 2024-01-29: rust-lang/rust#120468 - initial introduction of `wasm32-wasip1`
* 2024-06-18: rust-lang/rust#126662 - warn on usage of `wasm32-wasi`
* 2024-11-08: this PR - remove the `wasm32-wasi` target

The full transition schedule is in [this comment][comment] and is
summarized with:

* 2024-05-02: Rust 1.78 released with `wasm32-wasip1` target
* 2024-09-05: Rust 1.81 released warning on usage of `wasm32-wasi`
* 2025-01-09: Rust 1.84 to be released without the `wasm32-wasi` target

This means that support on stable for the replacement target of
`wasm32-wasip1` has currently been available for 6 months. Users have
already seen warnings on stable for 2 months about usage of
`wasm32-wasi` and stable users have another 2 months of warnings before
the target is removed from stable.

This commit is intended to be the final step in this transition so the
source tree should no longer mention `wasm32-wasi` except in historical
reference to the older name of the `wasm32-wasip1` target.

[comment]: https://github.com/rust-lang/rust/pull/120468#issuecomment-1977878747
2024-11-03 07:09:34 -08:00

114 lines
3.0 KiB
Rust

//@ revisions: aarch64-linux aarch64-darwin wasm32-wasip1
//@ compile-flags: -O -C no-prepopulate-passes
//@[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu
//@[aarch64-linux] needs-llvm-components: aarch64
//@[aarch64-darwin] compile-flags: --target aarch64-apple-darwin
//@[aarch64-darwin] needs-llvm-components: aarch64
//@[wasm32-wasip1] compile-flags: --target wasm32-wasip1
//@[wasm32-wasip1] needs-llvm-components: webassembly
// See ./transparent.rs
// Some platforms pass large aggregates using immediate arrays in LLVMIR
// Other platforms pass large aggregates using by-value struct pointer in LLVMIR
// Yet more platforms pass large aggregates using opaque pointer in LLVMIR
// This covers the "opaque pointer" case.
#![feature(no_core, lang_items, transparent_unions)]
#![crate_type = "lib"]
#![no_std]
#![no_core]
#[lang = "sized"]
trait Sized {}
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
impl Copy for [u32; 16] {}
impl Copy for BigS {}
impl Copy for BigU {}
#[repr(C)]
pub struct BigS([u32; 16]);
#[repr(transparent)]
pub struct TsBigS(BigS);
#[repr(transparent)]
pub union TuBigS {
field: BigS,
}
#[repr(transparent)]
pub enum TeBigS {
Variant(BigS),
}
// CHECK: define{{.*}}void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], ptr [[BIGS_ARG_ATTRS1:.*]])
#[no_mangle]
pub extern "C" fn test_BigS(_: BigS) -> BigS {
loop {}
}
// CHECK: define{{.*}}void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]])
#[no_mangle]
pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS {
loop {}
}
// CHECK: define{{.*}}void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]])
#[no_mangle]
pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS {
loop {}
}
// CHECK: define{{.*}}void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]])
#[no_mangle]
pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS {
loop {}
}
#[repr(C)]
pub union BigU {
foo: [u32; 16],
}
#[repr(transparent)]
pub struct TsBigU(BigU);
#[repr(transparent)]
pub union TuBigU {
field: BigU,
}
#[repr(transparent)]
pub enum TeBigU {
Variant(BigU),
}
// CHECK: define{{.*}}void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1:.*]])
#[no_mangle]
pub extern "C" fn test_BigU(_: BigU) -> BigU {
loop {}
}
// CHECK: define{{.*}}void @test_TsBigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]])
#[no_mangle]
pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU {
loop {}
}
// CHECK: define{{.*}}void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]])
#[no_mangle]
pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU {
loop {}
}
// CHECK: define{{.*}}void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]])
#[no_mangle]
pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU {
loop {}
}