Skip to content

Commit 8b16c5a

Browse files
authored
Unrolled build for rust-lang#132002
Rollup merge of rust-lang#132002 - RalfJung:abi-compat-option-like, r=compiler-errors abi/compatibility: also test Option-like types Adds tests for the decision [here](rust-lang#130628 (comment)). Cc ``@workingjubilee``
2 parents e1f3068 + d567fcc commit 8b16c5a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/ui/abi/compatibility.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,15 @@ impl Clone for Zst {
211211
}
212212
}
213213

214+
enum Either<T, U> {
215+
Left(T),
216+
Right(U),
217+
}
218+
enum Either2<T, U> {
219+
Left(T),
220+
Right(U, ()),
221+
}
222+
214223
#[repr(C)]
215224
enum ReprCEnum<T> {
216225
Variant1,
@@ -328,7 +337,8 @@ mod unsized_ {
328337
test_transparent_unsized!(dyn_trait, dyn Any);
329338
}
330339

331-
// RFC 3391 <https://rust-lang.github.io/rfcs/3391-result_ffi_guarantees.html>.
340+
// RFC 3391 <https://rust-lang.github.io/rfcs/3391-result_ffi_guarantees.html>, including the
341+
// extension ratified at <https://github.com/rust-lang/rust/pull/130628#issuecomment-2402761599>.
332342
macro_rules! test_nonnull {
333343
($name:ident, $t:ty) => {
334344
mod $name {
@@ -340,6 +350,12 @@ macro_rules! test_nonnull {
340350
test_abi_compatible!(result_ok_zst, Result<Zst, $t>, $t);
341351
test_abi_compatible!(result_err_arr, Result<$t, [i8; 0]>, $t);
342352
test_abi_compatible!(result_ok_arr, Result<[i8; 0], $t>, $t);
353+
test_abi_compatible!(result_err_void, Result<$t, Void>, $t);
354+
test_abi_compatible!(result_ok_void, Result<Void, $t>, $t);
355+
test_abi_compatible!(either_err_zst, Either<$t, Zst>, $t);
356+
test_abi_compatible!(either_ok_zst, Either<Zst, $t>, $t);
357+
test_abi_compatible!(either2_err_zst, Either2<$t, Zst>, $t);
358+
test_abi_compatible!(either2_err_arr, Either2<$t, [i8; 0]>, $t);
343359
}
344360
}
345361
}

0 commit comments

Comments
 (0)