diff options
| author | bors <bors@rust-lang.org> | 2022-10-18 10:54:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-18 10:54:53 +0000 |
| commit | 21b246587c2687935bd6004ffa5dcc4f4dd6600d (patch) | |
| tree | 0b7347a252d987b16b179fa2e494361642e68583 /library/std/src/sys | |
| parent | e0f8e60dddfecfc9093ee9d9f42557d8260c0355 (diff) | |
| parent | 727335878d316f6301780d182ea14ec4fb32531d (diff) | |
| download | rust-21b246587c2687935bd6004ffa5dcc4f4dd6600d.tar.gz rust-21b246587c2687935bd6004ffa5dcc4f4dd6600d.zip | |
Auto merge of #103075 - SUPERCILEX:miri-metadata, r=thomcc
Support DirEntry metadata calls in miri This should work as it uses lstat64 which is supported here: ~https://github.com/rust-lang/miri/blob/d9ad25ee4bbd9364c498959cdc82b5fa6c41e63c/src/shims/unix/macos/foreign_items.rs#L42~ just noticed that's macos, linux would be using statx: https://github.com/rust-lang/miri/blob/86f0e63b21721fe2c14608644f467b9cb21945eb/src/shims/unix/linux/foreign_items.rs#L112 The failing syscall is `dirfd`, so maybe that should actually be added to the shims?
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/unix/fs.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index 3ac01e6a27d..780f46f8c11 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -674,7 +674,10 @@ impl DirEntry { self.file_name_os_str().to_os_string() } - #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "android"))] + #[cfg(all( + any(target_os = "linux", target_os = "emscripten", target_os = "android"), + not(miri) + ))] pub fn metadata(&self) -> io::Result<FileAttr> { let fd = cvt(unsafe { dirfd(self.dir.dirp.0) })?; let name = self.name_cstr().as_ptr(); @@ -695,7 +698,10 @@ impl DirEntry { Ok(FileAttr::from_stat64(stat)) } - #[cfg(not(any(target_os = "linux", target_os = "emscripten", target_os = "android")))] + #[cfg(any( + not(any(target_os = "linux", target_os = "emscripten", target_os = "android")), + miri + ))] pub fn metadata(&self) -> io::Result<FileAttr> { lstat(&self.path()) } |
