Skip to content

Commit 10951f3

Browse files
committed
make sure the types in the ABI compat test actually type-check
1 parent 36b8e4a commit 10951f3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/ui/abi/compatibility.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ use std::marker::PhantomData;
55
use std::mem::ManuallyDrop;
66
use std::num::NonZeroI32;
77
use std::ptr::NonNull;
8+
use std::mem::ManuallyDrop;
89

910
macro_rules! assert_abi_compatible {
1011
($name:ident, $t1:ty, $t2:ty) => {
1112
mod $name {
1213
use super::*;
14+
// Declaring a `type` doesn't even check well-formedness, so we also declare a function.
15+
fn check_wf(_x: $t1, _y: $t2) {}
1316
// Test argument and return value, `Rust` and `C` ABIs.
1417
#[rustc_abi(assert_eq)]
1518
type TestRust = (fn($t1) -> $t1, fn($t2) -> $t2);
@@ -77,9 +80,9 @@ test_abi_compatible!(nonzero_int, NonZeroI32, i32);
7780

7881
// `repr(transparent)` compatibility.
7982
#[repr(transparent)]
80-
struct Wrapper1<T>(T);
83+
struct Wrapper1<T: ?Sized>(T);
8184
#[repr(transparent)]
82-
struct Wrapper2<T>((), Zst, T);
85+
struct Wrapper2<T: ?Sized>((), Zst, T);
8386
#[repr(transparent)]
8487
struct Wrapper3<T>(T, [u8; 0], PhantomData<u64>);
8588
#[repr(transparent)]

0 commit comments

Comments
 (0)