Skip to content

Commit ae9c26c

Browse files
committed
moved type_alias, added additional comments, altered unstable defines
1 parent 7290ae0 commit ae9c26c

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

library/core/src/ffi/mod.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,14 @@ pub use self::va_list::{VaList, VaListImpl};
3737
)]
3838
pub mod va_list;
3939

40-
macro_rules! type_alias {
41-
{
42-
$Docfile:tt, $Alias:ident = $Real:ty;
43-
$( $Cfg:tt )*
44-
} => {
45-
#[doc = include_str!($Docfile)]
46-
$( $Cfg )*
47-
#[stable(feature = "core_ffi_c", since = "1.64.0")]
48-
pub type $Alias = $Real;
49-
}
50-
}
51-
5240
mod primitives;
53-
#[unstable(feature = "c_ptrdiff_t", issue = "88345")]
54-
pub use self::primitives::c_ptrdiff_t;
55-
#[unstable(feature = "c_size_t", issue = "88345")]
56-
pub use self::primitives::c_size_t;
57-
#[unstable(feature = "c_ssize_t", issue = "88345")]
58-
pub use self::primitives::c_ssize_t;
5941
#[stable(feature = "core_ffi_c", since = "1.64.0")]
6042
pub use self::primitives::{
6143
c_char, c_double, c_float, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint,
6244
c_ulong, c_ulonglong, c_ushort,
6345
};
46+
#[unstable(feature = "c_size_t", issue = "88345")]
47+
pub use self::primitives::{c_ptrdiff_t, c_size_t, c_ssize_t};
6448

6549
// N.B., for LLVM to recognize the void pointer type and by extension
6650
// functions like malloc(), we need to have it represented as i8* in

library/core/src/ffi/primitives.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
//! Provides C-compatible primitive types to ensure correct type matching when interfacing with C code.
1+
//! Defines primitive types that match C's type definitions for FFI compatibility.
2+
//!
3+
//! This module is intentionally standalone to facilitate parsing when retrieving
4+
//! core C types.
5+
6+
macro_rules! type_alias {
7+
{
8+
$Docfile:tt, $Alias:ident = $Real:ty;
9+
$( $Cfg:tt )*
10+
} => {
11+
#[doc = include_str!($Docfile)]
12+
$( $Cfg )*
13+
#[stable(feature = "core_ffi_c", since = "1.64.0")]
14+
pub type $Alias = $Real;
15+
}
16+
}
217

318
type_alias! { "c_char.md", c_char = c_char_definition::c_char; #[doc(cfg(all()))] }
419

src/tools/tidy/src/pal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use std::path::Path;
3434

3535
use crate::walk::{filter_dirs, walk};
3636

37-
// Paths that may contain platform-specific code.
37+
// Paths that may contain platform-specific code.Is there any comment needed here for this?
3838
const EXCEPTION_PATHS: &[&str] = &[
3939
"library/windows_targets",
4040
"library/panic_abort",
@@ -48,7 +48,7 @@ const EXCEPTION_PATHS: &[&str] = &[
4848
// we must use `#[cfg(windows)]` to conditionally compile the
4949
// correct `VaList` structure for windows.
5050
"library/core/src/ffi/va_list.rs",
51-
// We placed a linkage against Windows libraries here
51+
// core::ffi contains platform-specific type and linkage configuration
5252
"library/core/src/ffi/mod.rs",
5353
"library/core/src/ffi/primitives.rs",
5454
"library/std/src/sys", // Platform-specific code for std lives here.

0 commit comments

Comments
 (0)