Skip to content

Commit

Permalink
Remove Windows dependency on libc
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Apr 18, 2024
1 parent cbbeb98 commit 4cd52ea
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 146 deletions.
10 changes: 5 additions & 5 deletions library/core/src/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,18 +537,18 @@ impl () {}
/// ## 4. Get it from C.
///
/// ```
/// # #![feature(rustc_private)]
/// #[allow(unused_extern_crates)]
/// extern crate libc;
///
/// # mod libc {
/// # pub unsafe fn malloc(_size: usize) -> *mut u8 { core::ptr::NonNull::dangling().as_ptr() }
/// # pub unsafe fn free(mem: *mut core::ffi::c_void) {}
/// # }
/// use std::mem;
///
/// unsafe {
/// let my_num: *mut i32 = libc::malloc(mem::size_of::<i32>()) as *mut i32;
/// if my_num.is_null() {
/// panic!("failed to allocate memory");
/// }
/// libc::free(my_num as *mut libc::c_void);
/// libc::free(my_num as *mut core::ffi::c_void);
/// }
/// ```
///
Expand Down
3 changes: 0 additions & 3 deletions library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ addr2line = { version = "0.21.0", optional = true, default-features = false }
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
libc = { version = "0.2.153", default-features = false, features = ['rustc-dep-of-std'], public = true }

[target.'cfg(all(windows, target_env = "msvc"))'.dependencies]
libc = { version = "0.2.153", default-features = false }

[target.'cfg(all(not(target_os = "aix"), not(all(windows, target_env = "msvc", not(target_vendor = "uwp")))))'.dependencies]
object = { version = "0.32.0", default-features = false, optional = true, features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive'] }

Expand Down
1 change: 1 addition & 0 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ extern crate alloc as alloc_crate;
// so include it here even if it's unused.
#[doc(masked)]
#[allow(unused_extern_crates)]
#[cfg(not(all(windows, target_env = "msvc")))]
extern crate libc;

// We always need an unwinder currently for backtraces
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/os/raw/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(not(all(windows, target_env = "msvc")))]

use crate::any::TypeId;

macro_rules! ok {
Expand Down
138 changes: 0 additions & 138 deletions tests/ui-fulldeps/regions-mock-tcx.rs

This file was deleted.

0 comments on commit 4cd52ea

Please sign in to comment.