-
Notifications
You must be signed in to change notification settings - Fork 390
Open
Labels
A-filesArea: related to files, paths, sockets, file descriptors, or handlesArea: related to files, paths, sockets, file descriptors, or handlesA-windowsArea: affects only Windows targetsArea: affects only Windows targetsC-bugCategory: This is a bug.Category: This is a bug.
Description
When calling File::create
and the file already exists, we hit an error on Windows targets:
error: unsupported operation: can't call foreign function `SetFileInformationByHandle` on OS `windows`
--> C:\Users\runneradmin\.rustup\toolchains\miri\lib\rustlib\src\rust\library\std\src\sys\pal\windows\api.rs:231:26
|
LL | let result = c::SetFileInformationByHandle(handle, class, info, size);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsupported operation occurred here
|
= help: this means the program tried to do something Miri does not support; it does not indicate a bug in the program
= note: BACKTRACE:
= note: inside `std::sys::pal::windows::api::set_file_information_by_handle::set_info` at C:\Users\runneradmin\.rustup\toolchains\miri\lib\rustlib\src\rust\library\std\src\sys\pal\windows\api.rs:231:26: 231:82
= note: inside `std::sys::pal::windows::api::set_file_information_by_handle::<std::sys::pal::windows::c::windows_sys::FILE_ALLOCATION_INFO>` at C:\Users\runneradmin\.rustup\toolchains\miri\lib\rustlib\src\rust\library\std\src\sys\pal\windows\api.rs:236:14: 236:68
= note: inside `std::sys::fs::windows::File::open_native` at C:\Users\runneradmin\.rustup\toolchains\miri\lib\rustlib\src\rust\library\std\src\sys\fs\windows.rs:333:17: 333:79
= note: inside `std::sys::fs::windows::File::open` at C:\Users\runneradmin\.rustup\toolchains\miri\lib\rustlib\src\rust\library\std\src\sys\fs\windows.rs:305:9: 305:39
= note: inside `std::fs::OpenOptions::_open` at C:\Users\runneradmin\.rustup\toolchains\miri\lib\rustlib\src\rust\library\std\src\fs.rs:1711:9: 1711:42
= note: inside `std::fs::OpenOptions::open::<&std::path::Path>` at C:\Users\runneradmin\.rustup\toolchains\miri\lib\rustlib\src\rust\library\std\src\fs.rs:1707:9: 1707:34
= note: inside `std::fs::File::create::<&std::path::PathBuf>` at C:\Users\runneradmin\.rustup\toolchains\miri\lib\rustlib\src\rust\library\std\src\fs.rs:521:9: 521:87
note: inside closure
--> tests/pass\shims\fs.rs:83:24
|
LL | let mut file = File::create(&path).unwrap();
| ^^^^^^^^^^^^^^^^^^^
Not sure why this has a different codepath, but this has to be this codepath.
Cc @CraftSpider -- any chance you could take a look at this?
Metadata
Metadata
Assignees
Labels
A-filesArea: related to files, paths, sockets, file descriptors, or handlesArea: related to files, paths, sockets, file descriptors, or handlesA-windowsArea: affects only Windows targetsArea: affects only Windows targetsC-bugCategory: This is a bug.Category: This is a bug.