Skip to content

Commit f931fda

Browse files
mbyxtgross35
authored andcommitted
libc: uncomment items that were commented due to old ctest
(backport <rust-lang#4682>) (cherry picked from commit 61b722e) [ resolution needed for primitives - Trevor ]
1 parent 00d08b7 commit f931fda

File tree

3 files changed

+4
-74
lines changed

3 files changed

+4
-74
lines changed

src/new/linux_uapi/linux/can.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
//! Header: `uapi/linux/can.h`
22
3-
// FIXME(ctest): we shouldn't have to specify the path but garando doesn't find modules otherwise
4-
#[path = "can/j1939.rs"]
53
pub(crate) mod j1939;
6-
#[path = "can/raw.rs"]
74
pub(crate) mod raw;
85

96
pub use j1939::*;

src/primitives.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -90,35 +90,6 @@ pub type uint64_t = u64;
9090

9191
cfg_if! {
9292
if #[cfg(all(target_arch = "aarch64", not(target_os = "windows")))] {
93-
// This introduces partial support for FFI with __int128 and
94-
// equivalent types on platforms where Rust's definition is validated
95-
// to match the standard C ABI of that platform.
96-
//
97-
// Rust does not guarantee u128/i128 are sound for FFI, and its
98-
// definitions are in fact known to be incompatible. [0]
99-
//
100-
// However these problems aren't fundamental, and are just platform
101-
// inconsistencies. Specifically at the time of this writing:
102-
//
103-
// * For x64 SysV ABIs (everything but Windows), the types are underaligned.
104-
// * For all Windows ABIs, Microsoft doesn't actually officially define __int128,
105-
// and as a result different implementations don't actually agree on its ABI.
106-
//
107-
// But on the other major aarch64 platforms (android, linux, ios, macos) we have
108-
// validated that rustc has the right ABI for these types. This is important because
109-
// aarch64 uses these types in some fundamental OS types like user_fpsimd_struct,
110-
// which represents saved simd registers.
111-
//
112-
// Any API which uses these types will need to `#[ignore(improper_ctypes)]`
113-
// until the upstream rust issue is resolved, but this at least lets us make
114-
// progress on platforms where this type is important.
115-
//
116-
// The list of supported architectures and OSes is intentionally very restricted,
117-
// as careful work needs to be done to verify that a particular platform
118-
// has a conformant ABI.
119-
//
120-
// [0]: https://github.com/rust-lang/rust/issues/54341
121-
12293
/// C `__int128` (a GCC extension that's part of many ABIs)
12394
pub type __int128 = i128;
12495
/// C `unsigned __int128` (a GCC extension that's part of many ABIs)
@@ -127,40 +98,5 @@ cfg_if! {
12798
pub type __int128_t = i128;
12899
/// C __uint128_t (alternate name for [__uint128][])
129100
pub type __uint128_t = u128;
130-
131-
// NOTE: if you add more platforms to here, you may need to cfg
132-
// these consts. They should always match the platform's values
133-
// for `sizeof(__int128)` and `_Alignof(__int128)`.
134-
const _SIZE_128: usize = 16;
135-
const _ALIGN_128: usize = 16;
136-
137-
// FIXME(ctest): ctest doesn't handle `_` as an identifier so these tests are temporarily
138-
// disabled.
139-
// macro_rules! static_assert_eq {
140-
// ($a:expr, $b:expr) => {
141-
// const _: [(); $a] = [(); $b];
142-
// };
143-
// }
144-
//
145-
// // Since Rust doesn't officially guarantee that these types
146-
// // have compatible ABIs, we const assert that these values have the
147-
// // known size/align of the target platform's libc. If rustc ever
148-
// // tries to regress things, it will cause a compilation error.
149-
// //
150-
// // This isn't a bullet-proof solution because e.g. it doesn't
151-
// // catch the fact that llvm and gcc disagree on how x64 __int128
152-
// // is actually *passed* on the stack (clang underaligns it for
153-
// // the same reason that rustc *never* properly aligns it).
154-
// static_assert_eq!(size_of::<__int128>(), _SIZE_128);
155-
// static_assert_eq!(align_of::<__int128>(), _ALIGN_128);
156-
157-
// static_assert_eq!(size_of::<__uint128>(), _SIZE_128);
158-
// static_assert_eq!(align_of::<__uint128>(), _ALIGN_128);
159-
160-
// static_assert_eq!(size_of::<__int128_t>(), _SIZE_128);
161-
// static_assert_eq!(align_of::<__int128_t>(), _ALIGN_128);
162-
163-
// static_assert_eq!(size_of::<__uint128_t>(), _SIZE_128);
164-
// static_assert_eq!(align_of::<__uint128_t>(), _ALIGN_128);
165101
}
166102
}

src/unix/linux_like/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,13 +1746,10 @@ cfg_if! {
17461746

17471747
/// Build an ioctl number, analogous to the C macro of the same name.
17481748
const fn _IOC(dir: u32, ty: u32, nr: u32, size: usize) -> Ioctl {
1749-
// FIXME(ctest) the `garando_syntax` crate (used by ctest in the CI test suite)
1750-
// cannot currently parse these `debug_assert!`s
1751-
//
1752-
// debug_assert!(dir <= _IOC_DIRMASK);
1753-
// debug_assert!(ty <= _IOC_TYPEMASK);
1754-
// debug_assert!(nr <= _IOC_NRMASK);
1755-
// debug_assert!(size <= (_IOC_SIZEMASK as usize));
1749+
core::debug_assert!(dir <= _IOC_DIRMASK);
1750+
core::debug_assert!(ty <= _IOC_TYPEMASK);
1751+
core::debug_assert!(nr <= _IOC_NRMASK);
1752+
core::debug_assert!(size <= (_IOC_SIZEMASK as usize));
17561753

17571754
((dir << _IOC_DIRSHIFT)
17581755
| (ty << _IOC_TYPESHIFT)

0 commit comments

Comments
 (0)