diff options
| author | Mads Marquart <mads@marquart.dk> | 2024-10-10 20:45:39 +0200 |
|---|---|---|
| committer | Mads Marquart <mads@marquart.dk> | 2024-11-22 07:59:51 +0100 |
| commit | f98d9dd334b4ff254912533d8b9b3cc4349f6f6a (patch) | |
| tree | 86b0567b3205a6111a6a3338a0c3eb1b79c3505f /library/std/src/sys/pal/unix/os.rs | |
| parent | b62ee10e5448a077e67e46f6907a4a04415895a8 (diff) | |
| download | rust-f98d9dd334b4ff254912533d8b9b3cc4349f6f6a.tar.gz rust-f98d9dd334b4ff254912533d8b9b3cc4349f6f6a.zip | |
Don't try to use confstr in Miri
Diffstat (limited to 'library/std/src/sys/pal/unix/os.rs')
| -rw-r--r-- | library/std/src/sys/pal/unix/os.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs index d26a1bdef74..f207131ddf3 100644 --- a/library/std/src/sys/pal/unix/os.rs +++ b/library/std/src/sys/pal/unix/os.rs @@ -704,7 +704,9 @@ pub fn page_size() -> usize { // // [posix_confstr]: // https://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html -#[cfg(target_vendor = "apple")] +// +// FIXME: Support `confstr` in Miri. +#[cfg(all(target_vendor = "apple", not(miri)))] fn confstr(key: c_int, size_hint: Option<usize>) -> io::Result<OsString> { let mut buf: Vec<u8> = Vec::with_capacity(0); let mut bytes_needed_including_nul = size_hint @@ -753,7 +755,7 @@ fn confstr(key: c_int, size_hint: Option<usize>) -> io::Result<OsString> { Ok(OsString::from_vec(buf)) } -#[cfg(target_vendor = "apple")] +#[cfg(all(target_vendor = "apple", not(miri)))] fn darwin_temp_dir() -> PathBuf { confstr(libc::_CS_DARWIN_USER_TEMP_DIR, Some(64)).map(PathBuf::from).unwrap_or_else(|_| { // It failed for whatever reason (there are several possible reasons), @@ -765,7 +767,7 @@ fn darwin_temp_dir() -> PathBuf { pub fn temp_dir() -> PathBuf { crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| { cfg_if::cfg_if! { - if #[cfg(target_vendor = "apple")] { + if #[cfg(all(target_vendor = "apple", not(miri)))] { darwin_temp_dir() } else if #[cfg(target_os = "android")] { PathBuf::from("/data/local/tmp") |
