From e471884df55e1da9bf55eb8a158b15a758d5c954 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 25 Oct 2020 08:18:49 +0900 Subject: [PATCH 1/2] Add a deprecation note to `time_t` on musl --- src/unix/linux_like/linux/musl/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 501f0684945a4..3fbd389403c35 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -1,5 +1,11 @@ pub type pthread_t = *mut ::c_void; pub type clock_t = c_long; +#[deprecated( + since = "0.2.80", + note = "This type is changed to 64-bit in musl 1.2.0, \ + we'll follow that change in the future release. \ + See #1848 for more info." +)] pub type time_t = c_long; pub type suseconds_t = c_long; pub type ino_t = u64; From d40c7ebdf6687e03bd1eb76ad0f9aea424a63e0c Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 25 Oct 2020 11:15:11 +0900 Subject: [PATCH 2/2] Allow deprecated `time_t` on musl --- src/unix/mod.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index ef24a1cb339bb..d3b43769fe400 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -1315,23 +1315,33 @@ extern "C" { pub fn res_init() -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] + #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t` pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")] + #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t` pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; #[cfg_attr( all(target_os = "macos", target_arch = "x86"), link_name = "mktime$UNIX2003" )] #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")] + #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t` pub fn mktime(tm: *mut tm) -> time_t; #[cfg_attr(target_os = "netbsd", link_name = "__time50")] + #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t` pub fn time(time: *mut time_t) -> time_t; #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")] + #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t` pub fn gmtime(time_p: *const time_t) -> *mut tm; #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")] + #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t` pub fn localtime(time_p: *const time_t) -> *mut tm; #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")] + #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t` pub fn difftime(time1: time_t, time0: time_t) -> ::c_double; + #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")] + #[cfg_attr(target_env = "musl", allow(deprecated))] // FIXME: for `time_t` + pub fn timegm(tm: *mut ::tm) -> time_t; #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] #[cfg_attr( @@ -1446,9 +1456,6 @@ extern "C" { #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")] pub fn sigpending(set: *mut sigset_t) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")] - pub fn timegm(tm: *mut ::tm) -> time_t; - pub fn sysconf(name: ::c_int) -> ::c_long; pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;