Skip to content

Commit fa554bc

Browse files
committed
Drop the libc_const_extern_fn conditional
Additionally deprecate the `const-extern-fn` feature. This is possible since the MSRV was increased to 1.63. (apply <#4063> to `main`) (cherry picked from commit 674cc1f)
1 parent c2b4a01 commit fa554bc

File tree

3 files changed

+5
-23
lines changed

3 files changed

+5
-23
lines changed

Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ rust-version = "1.63"
1616
description = "Raw FFI bindings to platform libraries like libc."
1717

1818
[package.metadata.docs.rs]
19-
features = ["const-extern-fn", "extra_traits"]
19+
features = ["extra_traits"]
2020
default-target = "x86_64-unknown-linux-gnu"
2121
targets = [
2222
"aarch64-apple-darwin",
@@ -139,6 +139,9 @@ default = ["std"]
139139
std = []
140140
rustc-dep-of-std = ["rustc-std-workspace-core"]
141141
extra_traits = []
142+
143+
# `const-extern-function` is deprecated and no longer does anything
144+
# FIXME(1.0): remove this completely
142145
const-extern-fn = []
143146

144147
[workspace]

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ libc = "0.2"
4949
* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`.
5050
This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`.
5151

52-
* `const-extern-fn`: Changes some `extern fn`s into `const extern fn`s. If you
53-
use Rust >= 1.62, this feature is implicitly enabled. Otherwise it requires a
54-
nightly rustc.
55-
5652
## Rust version support
5753

5854
The minimum supported Rust toolchain version is currently **Rust 1.63**.

build.rs

+1-18
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
1414
"freebsd13",
1515
"freebsd14",
1616
"freebsd15",
17-
"libc_const_extern_fn",
18-
"libc_const_extern_fn_unstable",
1917
"libc_deny_warnings",
2018
"libc_ctest",
2119
];
@@ -39,11 +37,10 @@ fn main() {
3937
// Avoid unnecessary re-building.
4038
println!("cargo:rerun-if-changed=build.rs");
4139

42-
let (rustc_minor_ver, is_nightly) = rustc_minor_nightly();
40+
let (rustc_minor_ver, _is_nightly) = rustc_minor_nightly();
4341
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
4442
let libc_ci = env::var("LIBC_CI").is_ok();
4543
let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok() || rustc_minor_ver >= 80;
46-
let const_extern_fn_cargo_feature = env::var("CARGO_FEATURE_CONST_EXTERN_FN").is_ok();
4744

4845
// The ABI of libc used by std is backward compatible with FreeBSD 12.
4946
// The ABI of libc from crates.io is backward compatible with FreeBSD 11.
@@ -78,20 +75,6 @@ fn main() {
7875
set_cfg("libc_deny_warnings");
7976
}
8077

81-
// Rust >= 1.62.0 allows to use `const_extern_fn` for "Rust" and "C".
82-
if rustc_minor_ver >= 62 {
83-
set_cfg("libc_const_extern_fn");
84-
} else {
85-
// Rust < 1.62.0 requires a crate feature and feature gate.
86-
if const_extern_fn_cargo_feature {
87-
if !is_nightly || rustc_minor_ver < 40 {
88-
panic!("const-extern-fn requires a nightly compiler >= 1.40");
89-
}
90-
set_cfg("libc_const_extern_fn_unstable");
91-
set_cfg("libc_const_extern_fn");
92-
}
93-
}
94-
9578
// check-cfg is a nightly cargo/rustc feature to warn when unknown cfgs are used across the
9679
// codebase. libc can configure it if the appropriate environment variable is passed. Since
9780
// rust-lang/rust enforces it, this is useful when using a custom libc fork there.

0 commit comments

Comments
 (0)