Skip to content

Commit a1571b4

Browse files
committed
make memcmp return a value of c_int_width instead of i32
1 parent 2904c07 commit a1571b4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

core/src/ffi/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ type_alias! { "c_schar.md", c_schar = i8, NonZero_c_schar = NonZeroI8; }
5757
type_alias! { "c_uchar.md", c_uchar = u8, NonZero_c_uchar = NonZeroU8; }
5858
type_alias! { "c_short.md", c_short = i16, NonZero_c_short = NonZeroI16; }
5959
type_alias! { "c_ushort.md", c_ushort = u16, NonZero_c_ushort = NonZeroU16; }
60+
#[cfg(any(target_arch = "avr", target_arch = "msp430"))]
61+
type_alias! { "c_int.md", c_int = i16, NonZero_c_int = NonZeroI16; }
62+
#[cfg(not(any(target_arch = "avr", target_arch = "msp430")))]
6063
type_alias! { "c_int.md", c_int = i32, NonZero_c_int = NonZeroI32; }
6164
type_alias! { "c_uint.md", c_uint = u32, NonZero_c_uint = NonZeroU32; }
6265
type_alias! { "c_long.md", c_long = i32, NonZero_c_long = NonZeroI32;

core/src/slice/cmp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Comparison traits for `[T]`.
22
33
use crate::cmp::{self, Ordering};
4+
use crate::ffi;
45
use crate::mem;
56

67
use super::from_raw_parts;
@@ -13,8 +14,7 @@ extern "C" {
1314
///
1415
/// Returns 0 for equal, < 0 for less than and > 0 for greater
1516
/// than.
16-
// FIXME(#32610): Return type should be c_int
17-
fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32;
17+
fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> ffi::c_int;
1818
}
1919

2020
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)