rust: fix building on macOS (issue6801)
The VFS change is copied over from Cargo, and likely to apply to other platforms as well.
The dirstate change is essentially a replay of 440972d2175d, which was reverted in e98fd81bb151, part of !383 (merged), to silence some clippy warnings.
Edited by Dan Villiom Podlaski Christiansen