diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-03 22:30:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-03 22:30:50 +0200 |
| commit | a44532c13ce87907eef00a1906d5498a8fb3c098 (patch) | |
| tree | 9be6b725c6aefa580eee0a45357b9ce4d3757aaf /library/std/src | |
| parent | d4bd4ae27a50866a948d751b0c94ad2281f0e3cb (diff) | |
| parent | e86c128aa3f76e46131d52da1c7ee00921e72094 (diff) | |
| download | rust-a44532c13ce87907eef00a1906d5498a8fb3c098.tar.gz rust-a44532c13ce87907eef00a1906d5498a8fb3c098.zip | |
Rollup merge of #100119 - ivmarkov:master, r=joshtriplett
FilesTimes support does not build for ESP-IDF Commit https://github.com/rust-lang/rust/commit/1f5d8d49eb6111931091f700d07518cd2b80bc18 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.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sys/unix/fs.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index 41405cbf657..b5cc8038ca4 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -544,9 +544,11 @@ impl Default for FileTimes { fn default() -> Self { // Redox doesn't appear to support `UTIME_OMIT`, so we stub it out here, and always return // an error in `set_times`. - #[cfg(target_os = "redox")] + // ESP-IDF does not support `futimens` at all and the behavior for that OS is therefore + // the same as for Redox. + #[cfg(any(target_os = "redox", target_os = "espidf"))] let omit = libc::timespec { tv_sec: 0, tv_nsec: 0 }; - #[cfg(not(target_os = "redox"))] + #[cfg(not(any(target_os = "redox", target_os = "espidf")))] let omit = libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ }; Self([omit; 2]) } @@ -1077,8 +1079,10 @@ impl File { pub fn set_times(&self, times: FileTimes) -> io::Result<()> { cfg_if::cfg_if! { - if #[cfg(target_os = "redox")] { + if #[cfg(any(target_os = "redox", target_os = "espidf"))] { // Redox doesn't appear to support `UTIME_OMIT`. + // ESP-IDF does not support `futimens` at all and the behavior for that OS is therefore + // the same as for Redox. drop(times); Err(io::const_io_error!( io::ErrorKind::Unsupported, |
