Open
Description
I tried this code:
let mut f = File::create("before:after").unwrap();
f.write("test".as_bytes()).unwrap();
f.sync_all().unwrap();
I expected to see this happen:
The file creation produces an error, because file paths cannot contain colons on Windows.
Instead, this happened:
There were no errors. Instead, an empty file named before
was created.
Note in particular:
- The file was named
before
, despite the requested name beingbefore:after
. - The file was empty, despite the fact that the code succesfully wrote some text to it and synchronized the writes to disk.
Other observations:
When the file name contains multiple colons then the file creation does produce an error, as expected.
Meta
rustc --version --verbose
:
rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: x86_64-pc-windows-msvc
release: 1.83.0
LLVM version: 19.1.1
Tested on Windows 10 Home version 10.0.19045 Build 19045.