Support getting file metadata on Windows
Main changes are the first two commits - one refactors handles a bit to make their usage more consistent and adds the file variant, the other actually adds the metadata shims.
This also changes miri to never return invalid handle errors, instead always treating them as an error. This behavior matches that of code running under the MSVC debugger - invalid handles are treated as exceptions in debug contexts.
Split off #4043
Before we get too much further on this PR, I'd like to point out https://github.com/rust-lang/miri/pull/4043/commits/296d806930304c03f2cba91cc8a2fed4a2f38d16 (which I just pushed) on the big PR. It's the changes needed to FileDescription methods to make them platform-agnostic enough for Windows use-cases. If they look fine, we can continue, but if you think it's a bad design then the FileDescription trait will need entirely split in two, which will change code even in this PR.
Reducing the places where we have to use global state like errno seems like an improvement. But please use Result<_, IoError> (with Miri's IoError type).
@rustbot ready
Okay I finally had a look at the core new file in this PR. :) @rustbot author
@rustbot ready
:umbrella: The latest upstream changes (presumably #4068) made this pull request unmergeable. Please resolve the merge conflicts.
@rustbot author
:umbrella: The latest upstream changes (possibly 887b4984e2ec4690afb6aa2c3f31408b570033ca) made this pull request unmergeable. Please resolve the merge conflicts.
:umbrella: The latest upstream changes (possibly aaa8151e524d1e0c87137ba64a260330e67ed0b0) made this pull request unmergeable. Please resolve the merge conflicts.
Amazing timing, me. I'm on vacation for the next week, but will rebase again after
Oh, was this waiting for review? Sorry, that wasn't clear to me. Please write @rustbot review once the PR is ready again.
No problem, I forgot to do that a while back, then didn't want to do it until I rebased, and somewhere along the way a test started failing... So I'll fix everything that fell out from a month of going stale, then mark it ready.
@rustbot review
@RalfJung any update on this? It's fine if you're busy or such, just don't want it to get too stale again hopefully
Sorry for the delay. It's in my queue, I have not lost track. :)
Thanks, sorry for the unnecessary ping then.
@rustbot author
@rustbot review
:umbrella: The latest upstream changes (possibly 7df496c4c37acdc832c4296a47b783a4882960a2) made this pull request unmergeable. Please resolve the merge conflicts.
Reminder, once the PR becomes ready for a review, use @rustbot ready.
Thanks for the patience and help with getting this over the line! After this merges, I'll work to flesh out the shims more, make it so you can actually do useful things with files targeting Windows.
@rustbot ready
Thank you for your patience with the sometimes slow round-trip times. :)
This looks great, thanks! Please squash the commits, then we can land this. Please use the --keep-base flag when squashing so that the force-push diff is easier to review. Then write @rustbot ready after you pushed the squashed PR.
@rustbot author
@rustbot review