File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ libc = "0.2"
35
35
This feature derives ` Debug ` , ` Eq ` , ` Hash ` , and ` PartialEq ` .
36
36
37
37
* ` const-extern-fn ` : Changes some ` extern fn ` s into ` const extern fn ` s.
38
- This feature requires a nightly rustc.
38
+ If you use Rust >= 1.62, this feature is implicitly enabled.
39
+ Otherwise it requires a nightly rustc.
39
40
40
41
* ** deprecated** : ` use_std ` is deprecated, and is equivalent to ` std ` .
41
42
@@ -53,6 +54,7 @@ newer Rust features are only available on newer Rust toolchains:
53
54
| ` core::ffi::c_void ` | 1.30.0 |
54
55
| ` repr(packed(N)) ` | 1.33.0 |
55
56
| ` cfg(target_vendor) ` | 1.33.0 |
57
+ | ` const-extern-fn ` | 1.62.0 |
56
58
57
59
## Platform support
58
60
Original file line number Diff line number Diff line change @@ -97,11 +97,18 @@ fn main() {
97
97
println ! ( "cargo:rustc-cfg=libc_thread_local" ) ;
98
98
}
99
99
100
- if const_extern_fn_cargo_feature {
101
- if !is_nightly || rustc_minor_ver < 40 {
102
- panic ! ( "const-extern-fn requires a nightly compiler >= 1.40" )
103
- }
100
+ // Rust >= 1.62.0 allows to use `const_extern_fn` for "Rust" and "C".
101
+ if rustc_minor_ver >= 62 {
104
102
println ! ( "cargo:rustc-cfg=libc_const_extern_fn" ) ;
103
+ } else {
104
+ // Rust < 1.62.0 requires a crate feature and feature gate.
105
+ if const_extern_fn_cargo_feature {
106
+ if !is_nightly || rustc_minor_ver < 40 {
107
+ panic ! ( "const-extern-fn requires a nightly compiler >= 1.40" ) ;
108
+ }
109
+ println ! ( "cargo:rustc-cfg=libc_const_extern_fn_unstable" ) ;
110
+ println ! ( "cargo:rustc-cfg=libc_const_extern_fn" ) ;
111
+ }
105
112
}
106
113
}
107
114
Original file line number Diff line number Diff line change 30
30
feature = "rustc-dep-of-std" ,
31
31
feature( native_link_modifiers, native_link_modifiers_bundle)
32
32
) ]
33
- #![ cfg_attr( libc_const_extern_fn , feature( const_extern_fn) ) ]
33
+ #![ cfg_attr( libc_const_extern_fn_unstable , feature( const_extern_fn) ) ]
34
34
35
35
#[ macro_use]
36
36
mod macros;
You can’t perform that action at this time.
0 commit comments