File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ const ALLOWED_CFGS: &[&str] = &[
3535 // Corresponds to `_REDIR_TIME64` in musl: symbol redirects to __*_time64
3636 "musl_redir_time64" ,
3737 "vxworks_lt_25_09" ,
38+ // Exists for Windows x86 GNU to use a 64-bit wide `time_t` instead of the
39+ // incorrect 32-bit wide `time_t` that we have on stable.
40+ "windows_gnu_time64" ,
3841] ;
3942
4043// Extra values to allow for check-cfg.
@@ -131,6 +134,14 @@ fn main() {
131134 }
132135 }
133136
137+ if target_arch == "x86"
138+ && target_os == "windows"
139+ && target_env == "gnu"
140+ && env_flag ( "CARGO_CFG_LIBC_UNSTABLE_WINDOWS_GNU_TIME64" )
141+ {
142+ set_cfg ( "windows_gnu_time64" ) ;
143+ }
144+
134145 let linux_time_bits64 = env:: var ( "RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64" ) . is_ok ( ) ;
135146 println ! ( "cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64" ) ;
136147 if linux_time_bits64 {
Original file line number Diff line number Diff line change @@ -54,4 +54,5 @@ if [ "$env" = "gnu" ] && [ "$bits" = "32" ]; then
5454 RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS=64 $cmd -- $test_flags
5555 # shellcheck disable=SC2086
5656 RUST_LIBC_UNSTABLE_GNU_TIME_BITS=64 $cmd -- $test_flags
57+ RUSTFLAGS=" $RUSTFLAGS --cfg=libc_unstable_windows_gnu_time64=\" 1\" " $cmd -- $test_flags
5758fi
Original file line number Diff line number Diff line change @@ -242,8 +242,12 @@ def run(
242242 args : Sequence [str | Path ],
243243 * ,
244244 env : Optional [dict [str , str ]] = None ,
245+ extra_rustflags : Optional [str ] = None ,
245246 check : bool = True ,
246247) -> sp .CompletedProcess :
248+ if extra_rustflags is not None :
249+ env ["RUSTFLAGS" ] = env .get ("RUSTFLAGS" , "" ) + " " + extra_rustflags
250+
247251 xtrace (args , env = env )
248252 return sp .run (args , env = env , check = check )
249253
@@ -396,6 +400,9 @@ def test_target(cfg: Cfg, target: Target) -> TargetResult:
396400 run (cmd , env = env | {"RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS" : "64" })
397401 # Equivalent of _TIME_BITS=64
398402 run (cmd , env = env | {"RUST_LIBC_UNSTABLE_GNU_TIME_BITS" : "64" })
403+ # For Windows x86 GNU to test out a backwards-incompatible 64-bit wide
404+ # `time_t`
405+ run (cmd , env = env , extra_rustflags = "--cfg=libc_unstable_windows_gnu_time64=\" 1\" " )
399406
400407 if "musl" in target_env :
401408 # Check with breaking changes from musl, including 64-bit time_t on 32-bit
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ pub type clock_t = i32;
1919pub type errno_t = c_int ;
2020
2121cfg_if ! {
22- if #[ cfg( all( target_arch = "x86" , target_env = "gnu" ) ) ] {
22+ if #[ cfg( all( target_arch = "x86" , target_env = "gnu" , not ( windows_gnu_time64 ) ) ) ] {
2323 pub type time_t = i32 ;
2424 } else {
2525 pub type time_t = i64 ;
@@ -34,6 +34,12 @@ extern_ty! {
3434 pub enum timezone { }
3535}
3636
37+ #[ deprecated(
38+ since = "1.0.0" ,
39+ note = "This time-related value, among others, is part of the shift \
40+ towards using a single, 64-bit-sized `time_t`. See #PENDING for \
41+ discussion."
42+ ) ]
3743pub type time64_t = i64 ;
3844
3945pub type SOCKET = crate :: uintptr_t ;
You can’t perform that action at this time.
0 commit comments