libc: uncomment items that were commented due to old ctest#4682
libc: uncomment items that were commented due to old ctest#4682tgross35 merged 1 commit intorust-lang:mainfrom
Conversation
20ddb7a to
329b56f
Compare
src/primitives.rs
Outdated
| // FIXME(ctest): ctest doesn't handle `_` as an identifier so these tests are temporarily | ||
| // disabled. | ||
| // macro_rules! static_assert_eq { | ||
| // ($a:expr, $b:expr) => { | ||
| // const _: [(); $a] = [(); $b]; | ||
| // }; | ||
| // } | ||
| macro_rules! static_assert_eq { | ||
| ($a:expr, $b:expr) => { | ||
| const _: [(); $a] = [(); $b]; | ||
| }; | ||
| } | ||
|
|
||
| // Since Rust doesn't officially guarantee that these types | ||
| // have compatible ABIs, we const assert that these values have the | ||
| // known size/align of the target platform's libc. If rustc ever | ||
| // tries to regress things, it will cause a compilation error. | ||
| // | ||
| // // Since Rust doesn't officially guarantee that these types | ||
| // // have compatible ABIs, we const assert that these values have the | ||
| // // known size/align of the target platform's libc. If rustc ever | ||
| // // tries to regress things, it will cause a compilation error. | ||
| // // | ||
| // // This isn't a bullet-proof solution because e.g. it doesn't | ||
| // // catch the fact that llvm and gcc disagree on how x64 __int128 | ||
| // // is actually *passed* on the stack (clang underaligns it for | ||
| // // the same reason that rustc *never* properly aligns it). | ||
| // static_assert_eq!(size_of::<__int128>(), _SIZE_128); | ||
| // static_assert_eq!(align_of::<__int128>(), _ALIGN_128); | ||
|
|
||
| // static_assert_eq!(size_of::<__uint128>(), _SIZE_128); | ||
| // static_assert_eq!(align_of::<__uint128>(), _ALIGN_128); | ||
|
|
||
| // static_assert_eq!(size_of::<__int128_t>(), _SIZE_128); | ||
| // static_assert_eq!(align_of::<__int128_t>(), _ALIGN_128); | ||
|
|
||
| // static_assert_eq!(size_of::<__uint128_t>(), _SIZE_128); | ||
| // static_assert_eq!(align_of::<__uint128_t>(), _ALIGN_128); | ||
| // This isn't a bullet-proof solution because e.g. it doesn't | ||
| // catch the fact that llvm and gcc disagree on how x64 __int128 | ||
| // is actually *passed* on the stack (clang underaligns it for | ||
| // the same reason that rustc *never* properly aligns it). | ||
| static_assert_eq!(size_of::<__int128>(), _SIZE_128); | ||
| static_assert_eq!(align_of::<__int128>(), _ALIGN_128); | ||
|
|
||
| static_assert_eq!(size_of::<__uint128>(), _SIZE_128); | ||
| static_assert_eq!(align_of::<__uint128>(), _ALIGN_128); | ||
|
|
||
| static_assert_eq!(size_of::<__int128_t>(), _SIZE_128); | ||
| static_assert_eq!(align_of::<__int128_t>(), _ALIGN_128); | ||
|
|
||
| static_assert_eq!(size_of::<__uint128_t>(), _SIZE_128); | ||
| static_assert_eq!(align_of::<__uint128_t>(), _ALIGN_128); |
There was a problem hiding this comment.
This whole bit can actually be deleted, also the entire "This introduces partial support for FFI with __int128..." section above. The mentioned ABI issue has since been resolved, and since rust-lang/rust#137306 we say i128 will be compatible with __i128 on platforms where it is available.
Should resolve the test failure.
There was a problem hiding this comment.
The other error is related to debug_assert, I'm not sure where to put the import, since putting it at the top will make it unused on some platforms.
There was a problem hiding this comment.
I guess just do core::debug_assert!, same for any other needed imports here. The style thing should be fixed, but I don't think it's really worth worrying about
8c5c27a to
eedba5c
Compare
| /// C `__int128` (a GCC extension that's part of many ABIs) | ||
| pub type __int128 = i128; | ||
| /// C `unsigned __int128` (a GCC extension that's part of many ABIs) | ||
| pub type __uint128 = u128; |
There was a problem hiding this comment.
These should probably be kept under the above #[cfg(all(...))] gate
eedba5c to
7806bb2
Compare
There was a problem hiding this comment.
Sorry for the confusion; to clarify a bit, for #4682 (comment) I only meant that the quoted bit (long explanation + checks) can be deleted. __u?int128(_t)? need to stay around on the same platforms, so the cfg_if block needs to stay.
This should let you drop the build.rs changes
7806bb2 to
29dfcb5
Compare
29dfcb5 to
e68c4c5
Compare
(backport <rust-lang#4682>) (cherry picked from commit 61b722e) [ resolution needed for primitives - Trevor ]
(backport <rust-lang#4682>) (cherry picked from commit 61b722e) [ resolution needed for primitives - Trevor ]
Description
Sources
Checklist
libc-test/semverhave been updated*LASTor*MAXareincluded (see #3131)
cd libc-test && cargo test --target mytarget);especially relevant for platforms that may not be checked in CI