diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-10-23 06:51:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-23 06:51:24 +0200 |
| commit | 7e1dbaec130566c0d491b9e71ff09526eb396886 (patch) | |
| tree | 541ef8d12a9e995e8ea5b13a4f3ac2dcce8e8d94 | |
| parent | 38eaf608eb9e0dddda1de1e03b08be123450e9b6 (diff) | |
| parent | d567fcc3018e8a9b09cbbd1a56c2f8bbf7e56438 (diff) | |
| download | rust-7e1dbaec130566c0d491b9e71ff09526eb396886.tar.gz rust-7e1dbaec130566c0d491b9e71ff09526eb396886.zip | |
Rollup merge of #132002 - RalfJung:abi-compat-option-like, r=compiler-errors
abi/compatibility: also test Option-like types Adds tests for the decision [here](https://github.com/rust-lang/rust/pull/130628#issuecomment-2402761599). Cc ``@workingjubilee``
| -rw-r--r-- | tests/ui/abi/compatibility.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index 28c8063a923..33d67360ff1 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -211,6 +211,15 @@ impl Clone for Zst { } } +enum Either<T, U> { + Left(T), + Right(U), +} +enum Either2<T, U> { + Left(T), + Right(U, ()), +} + #[repr(C)] enum ReprCEnum<T> { Variant1, @@ -328,7 +337,8 @@ mod unsized_ { test_transparent_unsized!(dyn_trait, dyn Any); } -// RFC 3391 <https://rust-lang.github.io/rfcs/3391-result_ffi_guarantees.html>. +// RFC 3391 <https://rust-lang.github.io/rfcs/3391-result_ffi_guarantees.html>, including the +// extension ratified at <https://github.com/rust-lang/rust/pull/130628#issuecomment-2402761599>. macro_rules! test_nonnull { ($name:ident, $t:ty) => { mod $name { @@ -340,6 +350,12 @@ macro_rules! test_nonnull { test_abi_compatible!(result_ok_zst, Result<Zst, $t>, $t); test_abi_compatible!(result_err_arr, Result<$t, [i8; 0]>, $t); test_abi_compatible!(result_ok_arr, Result<[i8; 0], $t>, $t); + test_abi_compatible!(result_err_void, Result<$t, Void>, $t); + test_abi_compatible!(result_ok_void, Result<Void, $t>, $t); + test_abi_compatible!(either_err_zst, Either<$t, Zst>, $t); + test_abi_compatible!(either_ok_zst, Either<Zst, $t>, $t); + test_abi_compatible!(either2_err_zst, Either2<$t, Zst>, $t); + test_abi_compatible!(either2_err_arr, Either2<$t, [i8; 0]>, $t); } } } |
