Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace libc::{type} with crate::ffi::{type} #105524

Merged
merged 1 commit into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/std/src/fs/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use crate::time::{Duration, Instant};

use rand::RngCore;

#[cfg(target_os = "macos")]
use crate::ffi::{c_char, c_int};
#[cfg(unix)]
use crate::os::unix::fs::symlink as symlink_dir;
#[cfg(unix)]
Expand All @@ -24,8 +26,6 @@ use crate::os::windows::fs::{symlink_dir, symlink_file};
use crate::sys::fs::symlink_junction;
#[cfg(target_os = "macos")]
use crate::sys::weak::weak;
#[cfg(target_os = "macos")]
use libc::{c_char, c_int};

macro_rules! check {
($e:expr) => {
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/personality/emcc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! On Emscripten Rust panics are wrapped in C++ exceptions, so we just forward
//! to `__gxx_personality_v0` which is provided by Emscripten.

use libc::c_int;
use crate::ffi::c_int;
use unwind as uw;

// This is required by the compiler to exist (e.g., it's a lang item), but it's
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/personality/gcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
//! and the last personality routine transfers control to the catch block.

use super::dwarf::eh::{self, EHAction, EHContext};
use libc::{c_int, uintptr_t};
use crate::ffi::c_int;
use libc::uintptr_t;
use unwind as uw;

// Register ids were lifted from LLVM's TargetLowering::getExceptionPointerRegister()
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/windows/thread_parking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl Parker {

fn keyed_event_handle() -> c::HANDLE {
const INVALID: c::HANDLE = ptr::invalid_mut(!0);
static HANDLE: AtomicPtr<libc::c_void> = AtomicPtr::new(INVALID);
static HANDLE: AtomicPtr<crate::ffi::c_void> = AtomicPtr::new(INVALID);
match HANDLE.load(Relaxed) {
INVALID => {
let mut handle = c::INVALID_HANDLE_VALUE;
Expand Down
8 changes: 4 additions & 4 deletions library/std/src/sys_common/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::sys::net::{cvt, cvt_gai, cvt_r, init, wrlen_t, Socket};
use crate::sys_common::{AsInner, FromInner, IntoInner};
use crate::time::Duration;

use libc::{c_int, c_void};
use crate::ffi::{c_int, c_void};

cfg_if::cfg_if! {
if #[cfg(any(
Expand Down Expand Up @@ -47,7 +47,7 @@ cfg_if::cfg_if! {
target_os = "dragonfly", target_os = "freebsd",
target_os = "openbsd", target_os = "netbsd",
target_os = "solaris", target_os = "illumos"))] {
use libc::c_uchar;
use crate::ffi::c_uchar;
type IpV4MultiCastType = c_uchar;
} else {
type IpV4MultiCastType = c_int;
Expand Down Expand Up @@ -127,8 +127,8 @@ fn to_ipv6mr_interface(value: u32) -> c_int {
}

#[cfg(not(target_os = "android"))]
fn to_ipv6mr_interface(value: u32) -> libc::c_uint {
value as libc::c_uint
fn to_ipv6mr_interface(value: u32) -> crate::ffi::c_uint {
value as crate::ffi::c_uint
}

////////////////////////////////////////////////////////////////////////////////
Expand Down