Skip to content

Commit a44532c

Browse files
authored
Rollup merge of #100119 - ivmarkov:master, r=joshtriplett
FilesTimes support does not build for ESP-IDF Commit 1f5d8d4 broke STD for `target_os = "espidf"`. In future, we might come up with something more sophisticated (as in using the `utime` function which *is* available on the ESP-IDF platform), but for now we are treating ESP-IDF just like `Redox` in that the new API fails at runtime. Most important for us ATM is to restore successful compilation of STD on our platform.
2 parents d4bd4ae + e86c128 commit a44532c

File tree

1 file changed

+7
-3
lines changed
  • library/std/src/sys/unix

1 file changed

+7
-3
lines changed

library/std/src/sys/unix/fs.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,11 @@ impl Default for FileTimes {
544544
fn default() -> Self {
545545
// Redox doesn't appear to support `UTIME_OMIT`, so we stub it out here, and always return
546546
// an error in `set_times`.
547-
#[cfg(target_os = "redox")]
547+
// ESP-IDF does not support `futimens` at all and the behavior for that OS is therefore
548+
// the same as for Redox.
549+
#[cfg(any(target_os = "redox", target_os = "espidf"))]
548550
let omit = libc::timespec { tv_sec: 0, tv_nsec: 0 };
549-
#[cfg(not(target_os = "redox"))]
551+
#[cfg(not(any(target_os = "redox", target_os = "espidf")))]
550552
let omit = libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ };
551553
Self([omit; 2])
552554
}
@@ -1077,8 +1079,10 @@ impl File {
10771079

10781080
pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
10791081
cfg_if::cfg_if! {
1080-
if #[cfg(target_os = "redox")] {
1082+
if #[cfg(any(target_os = "redox", target_os = "espidf"))] {
10811083
// Redox doesn't appear to support `UTIME_OMIT`.
1084+
// ESP-IDF does not support `futimens` at all and the behavior for that OS is therefore
1085+
// the same as for Redox.
10821086
drop(times);
10831087
Err(io::const_io_error!(
10841088
io::ErrorKind::Unsupported,

0 commit comments

Comments
 (0)