File tree 4 files changed +25
-10
lines changed 4 files changed +25
-10
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;
Original file line number Diff line number Diff line change @@ -4682,6 +4682,16 @@ cfg_if! {
4682
4682
const __DARWIN_ALIGNBYTES32: usize = :: mem:: size_of:: <u32 >( ) - 1 ;
4683
4683
p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
4684
4684
}
4685
+ } else {
4686
+ fn __DARWIN_ALIGN32( p: usize ) -> usize {
4687
+ let __DARWIN_ALIGNBYTES32: usize = :: mem:: size_of:: <u32 >( ) - 1 ;
4688
+ p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
4689
+ }
4690
+ }
4691
+ }
4692
+
4693
+ cfg_if ! {
4694
+ if #[ cfg( libc_const_size_of) ] {
4685
4695
pub const THREAD_EXTENDED_POLICY_COUNT : mach_msg_type_number_t =
4686
4696
( :: mem:: size_of:: <thread_extended_policy_data_t>( ) / :: mem:: size_of:: <integer_t>( ) )
4687
4697
as mach_msg_type_number_t;
@@ -4722,10 +4732,6 @@ cfg_if! {
4722
4732
( :: mem:: size_of:: <vm_statistics64_data_t>( ) / :: mem:: size_of:: <integer_t>( ) )
4723
4733
as mach_msg_type_number_t;
4724
4734
} else {
4725
- fn __DARWIN_ALIGN32( p: usize ) -> usize {
4726
- let __DARWIN_ALIGNBYTES32: usize = :: mem:: size_of:: <u32 >( ) - 1 ;
4727
- p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
4728
- }
4729
4735
pub const THREAD_EXTENDED_POLICY_COUNT : mach_msg_type_number_t = 1 ;
4730
4736
pub const THREAD_TIME_CONSTRAINT_POLICY_COUNT : mach_msg_type_number_t = 4 ;
4731
4737
pub const THREAD_PRECEDENCE_POLICY_COUNT : mach_msg_type_number_t = 1 ;
You can’t perform that action at this time.
0 commit comments