diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index 28c8063a92311..33d67360ff11d 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -211,6 +211,15 @@ impl Clone for Zst { } } +enum Either { + Left(T), + Right(U), +} +enum Either2 { + Left(T), + Right(U, ()), +} + #[repr(C)] enum ReprCEnum { Variant1, @@ -328,7 +337,8 @@ mod unsized_ { test_transparent_unsized!(dyn_trait, dyn Any); } -// RFC 3391 . +// RFC 3391 , including the +// extension ratified at . 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, $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, $t); + test_abi_compatible!(either_err_zst, Either<$t, Zst>, $t); + test_abi_compatible!(either_ok_zst, Either, $t); + test_abi_compatible!(either2_err_zst, Either2<$t, Zst>, $t); + test_abi_compatible!(either2_err_arr, Either2<$t, [i8; 0]>, $t); } } }