@@ -99,6 +99,8 @@ cfg_if! {
9999 target_os = "watchos"
100100 ) )
101101 ) ) ] {
102+ use core:: mem:: { align_of, size_of} ;
103+
102104 // This introduces partial support for FFI with __int128 and
103105 // equivalent types on platforms where Rust's definition is validated
104106 // to match the standard C ABI of that platform.
@@ -143,34 +145,32 @@ cfg_if! {
143145 const _SIZE_128: usize = 16 ;
144146 const _ALIGN_128: usize = 16 ;
145147
146- // FIXME(ctest): ctest doesn't handle `_` as an identifier so these tests are temporarily
147- // disabled.
148- // macro_rules! static_assert_eq {
149- // ($a:expr, $b:expr) => {
150- // const _: [(); $a] = [(); $b];
151- // };
152- // }
148+ macro_rules! static_assert_eq {
149+ ( $a: expr, $b: expr) => {
150+ const _: [ ( ) ; $a] = [ ( ) ; $b] ;
151+ } ;
152+ }
153+
154+ // Since Rust doesn't officially guarantee that these types
155+ // have compatible ABIs, we const assert that these values have the
156+ // known size/align of the target platform's libc. If rustc ever
157+ // tries to regress things, it will cause a compilation error.
153158 //
154- // // Since Rust doesn't officially guarantee that these types
155- // // have compatible ABIs, we const assert that these values have the
156- // // known size/align of the target platform's libc. If rustc ever
157- // // tries to regress things, it will cause a compilation error.
158- // //
159- // // This isn't a bullet-proof solution because e.g. it doesn't
160- // // catch the fact that llvm and gcc disagree on how x64 __int128
161- // // is actually *passed* on the stack (clang underaligns it for
162- // // the same reason that rustc *never* properly aligns it).
163- // static_assert_eq!(size_of::<__int128>(), _SIZE_128);
164- // static_assert_eq!(align_of::<__int128>(), _ALIGN_128);
165-
166- // static_assert_eq!(size_of::<__uint128>(), _SIZE_128);
167- // static_assert_eq!(align_of::<__uint128>(), _ALIGN_128);
168-
169- // static_assert_eq!(size_of::<__int128_t>(), _SIZE_128);
170- // static_assert_eq!(align_of::<__int128_t>(), _ALIGN_128);
171-
172- // static_assert_eq!(size_of::<__uint128_t>(), _SIZE_128);
173- // static_assert_eq!(align_of::<__uint128_t>(), _ALIGN_128);
159+ // This isn't a bullet-proof solution because e.g. it doesn't
160+ // catch the fact that llvm and gcc disagree on how x64 __int128
161+ // is actually *passed* on the stack (clang underaligns it for
162+ // the same reason that rustc *never* properly aligns it).
163+ static_assert_eq!( size_of:: <__int128>( ) , _SIZE_128) ;
164+ static_assert_eq!( align_of:: <__int128>( ) , _ALIGN_128) ;
165+
166+ static_assert_eq!( size_of:: <__uint128>( ) , _SIZE_128) ;
167+ static_assert_eq!( align_of:: <__uint128>( ) , _ALIGN_128) ;
168+
169+ static_assert_eq!( size_of:: <__int128_t>( ) , _SIZE_128) ;
170+ static_assert_eq!( align_of:: <__int128_t>( ) , _ALIGN_128) ;
171+
172+ static_assert_eq!( size_of:: <__uint128_t>( ) , _SIZE_128) ;
173+ static_assert_eq!( align_of:: <__uint128_t>( ) , _ALIGN_128) ;
174174 } else if #[ cfg( all(
175175 target_arch = "aarch64" ,
176176 any(
0 commit comments