Skip to content

Commit 75071fe

Browse files
committed
Merge branch 'master' into strcase-various
2 parents cd6b95d + 530f31f commit 75071fe

File tree

7 files changed

+35
-26
lines changed

7 files changed

+35
-26
lines changed

Cargo.toml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
[package]
2-
32
name = "libc"
4-
version = "0.2.43"
3+
version = "0.2.44"
54
authors = ["The Rust Project Developers"]
65
license = "MIT OR Apache-2.0"
76
readme = "README.md"
87
repository = "https://github.com/rust-lang/libc"
98
homepage = "https://github.com/rust-lang/libc"
109
documentation = "http://doc.rust-lang.org/libc"
11-
description = """
12-
A library for types and bindings to native C functions often found in libc or
13-
other common platform libraries.
14-
"""
10+
keywords = ["libc", "ffi", "bindings", "operating", "system" ]
11+
categories = ["external-ffi-bindings", "no-std", "os"]
1512
build = "build.rs"
1613
exclude = ["/ci/*", "/.travis.yml", "/appveyor.yml"]
14+
description = """
15+
Raw FFI bindings to platform libraries like libc.
16+
"""
1717

1818
[badges]
1919
travis-ci = { repository = "rust-lang/libc" }
2020
appveyor = { repository = "rust-lang/libc", project_name = "rust-lang-libs/libc" }
2121

22+
[dependencies]
23+
rustc-std-workspace-core = { version = "1.0.0", optional = true }
24+
2225
[features]
2326
default = ["use_std"]
2427
use_std = []
2528
align = []
29+
rustc-dep-of-std = ['align', 'rustc-std-workspace-core']
2630

2731
[workspace]
2832
members = ["libc-test"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
libc
22
====
33

4-
Rust wrapper over the system's `libc`.
4+
Raw FFI bindings to platform libraries like `libc`.
55

66
[![Build Status](https://travis-ci.org/rust-lang/libc.svg?branch=master)](https://travis-ci.org/rust-lang/libc)
77
[![Build status](https://ci.appveyor.com/api/projects/status/github/rust-lang/libc?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/libc)

libc-test/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ fn main() {
449449
// which is absent in glibc, has to be defined.
450450
"__timeval" if linux => true,
451451

452-
// Fixed on stdbuild with repr(packed(4))
452+
// Fixed on feature=align with repr(packed(4))
453453
// Once repr_packed stabilizes we can fix this unconditionally
454454
// and remove this check.
455455
"kevent" | "shmid_ds" if apple && x86_64 => true,

src/lib.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,22 +150,25 @@
150150
)
151151
)]
152152
// Attributes needed when building as part of the standard library
153-
#![cfg_attr(feature = "stdbuild", feature(staged_api, cfg_target_vendor))]
154-
#![cfg_attr(feature = "stdbuild", feature(link_cfg, repr_packed))]
155-
#![cfg_attr(feature = "stdbuild", allow(warnings))]
156-
#![cfg_attr(
157-
feature = "stdbuild",
158-
unstable(
159-
feature = "libc",
160-
reason = "use `libc` from crates.io",
161-
issue = "27783"
162-
)
163-
)]
164-
#![cfg_attr(not(feature = "use_std"), no_std)]
153+
#![cfg_attr(feature = "rustc-dep-of-std", feature(cfg_target_vendor))]
154+
#![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, repr_packed))]
155+
#![cfg_attr(feature = "rustc-dep-of-std", feature(no_core))]
156+
#![cfg_attr(feature = "rustc-dep-of-std", no_core)]
157+
#![cfg_attr(feature = "rustc-dep-of-std", allow(warnings))]
158+
#![cfg_attr(not(any(feature = "use_std", feature = "rustc-dep-of-std")), no_std)]
165159

166160
#[cfg(all(not(cross_platform_docs), feature = "use_std"))]
167161
extern crate std as core;
168162

163+
#[cfg(feature = "rustc-dep-of-std")]
164+
extern crate rustc_std_workspace_core as core;
165+
#[cfg(feature = "rustc-dep-of-std")]
166+
#[allow(unused_imports)]
167+
use core::iter;
168+
#[cfg(feature = "rustc-dep-of-std")]
169+
#[allow(unused_imports)]
170+
use core::option;
171+
169172
#[macro_use]
170173
mod macros;
171174

src/unix/bsd/apple/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ s! {
245245
pub f_reserved: [::uint32_t; 8],
246246
}
247247

248-
#[cfg_attr(feature = "stdbuild", repr(packed(4)))]
248+
#[cfg_attr(feature = "rustc-dep-of-std", repr(packed(4)))]
249249
pub struct kevent {
250250
pub ident: ::uintptr_t,
251251
pub filter: ::int16_t,
@@ -535,7 +535,7 @@ s! {
535535
pub _key: ::key_t,
536536
}
537537

538-
#[cfg_attr(feature = "stdbuild", repr(packed(4)))]
538+
#[cfg_attr(feature = "rustc-dep-of-std", repr(packed(4)))]
539539
pub struct shmid_ds {
540540
pub shm_perm: ipc_perm,
541541
pub shm_segsz: ::size_t,
@@ -772,6 +772,7 @@ pub const MAP_SHARED: ::c_int = 0x0001;
772772
pub const MAP_PRIVATE: ::c_int = 0x0002;
773773
pub const MAP_FIXED: ::c_int = 0x0010;
774774
pub const MAP_ANON: ::c_int = 0x1000;
775+
pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
775776

776777
pub const VM_FLAGS_FIXED: ::c_int = 0x0000;
777778
pub const VM_FLAGS_ANYWHERE: ::c_int = 0x0001;

src/unix/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,18 @@ cfg_if! {
318318
// cargo build, don't pull in anything extra as the libstd dep
319319
// already pulls in all libs.
320320
} else if #[cfg(target_env = "musl")] {
321-
#[cfg_attr(feature = "stdbuild",
321+
#[cfg_attr(feature = "rustc-dep-of-std",
322322
link(name = "c", kind = "static",
323323
cfg(target_feature = "crt-static")))]
324-
#[cfg_attr(feature = "stdbuild",
324+
#[cfg_attr(feature = "rustc-dep-of-std",
325325
link(name = "c", cfg(not(target_feature = "crt-static"))))]
326326
extern {}
327327
} else if #[cfg(target_os = "emscripten")] {
328328
#[link(name = "c")]
329329
extern {}
330330
} else if #[cfg(all(target_os = "netbsd",
331-
feature = "stdbuild", target_vendor = "rumprun"))] {
331+
feature = "rustc-dep-of-std",
332+
target_vendor = "rumprun"))] {
332333
// Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
333334
// in automatically by the linker. We avoid passing it explicitly, as it
334335
// causes some versions of binutils to crash with an assertion failure.

src/windows/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub const EILSEQ: ::c_int = 42;
178178
pub const STRUNCATE: ::c_int = 80;
179179

180180
// inline comment below appeases style checker
181-
#[cfg(all(target_env = "msvc", feature = "stdbuild"))] // " if "
181+
#[cfg(all(target_env = "msvc", feature = "rustc-dep-of-std"))] // " if "
182182
#[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))]
183183
#[link(name = "libcmt", cfg(target_feature = "crt-static"))]
184184
extern {}

0 commit comments

Comments
 (0)