make 'fn convert_path_separator' to take 'Cow<>' as argument
Fixed `fn convert_path_separator()` to take `Cow<>` as argument,
in order to prevent unnecessary allocation when target & host path separators are equal.
Windows shims for GetCurrentDirectoryW/SetCurrentDirectoryW
Implemented shims for Windows
* [GetCurrentDirectoryW](75208942f6/src/libstd/sys/windows/os.rs (L242)) (`getcwd` for Windows)
* [SetCurrentDirectoryW](75208942f6/src/libstd/sys/windows/os.rs (L250)) (`chdir` for Windows)
Currently passes test :
`./miri run tests/run-pass/current_dir.rs -Zmiri-disable-isolation`
1. Fix 'fn convert_path_separator' in src/shims/os_str.rs
2. Fix 'fn set_last_error_from_io_error' in src/helpers.rs
3. Minor comment fix for 'fn SetCurrentDirectoryW' in src/shims/env.rs
move OsStr helpers to a separate file
Moved OsStr read/write functions from `src/helpers.rs` to `src/shims/os_str.rs`, in order to keep `src/helpers.rs` from bloating too much.
we don't deallocate the environ global, so leave it in the machine
Follow-up to https://github.com/rust-lang/miri/pull/1271. I forgot to adjust this when my plans changed a bit.
env shim: make sure we clean up all the memory we allocate
`Machine` memory is not leak-checked, so if we forgot to deallocate part of the env shim memory, we wouldn't even notice. Thus add a dedicated memory kind that is leak-checked.
Add shims for env var emulation in Windows
This PR attempts to implement the final step of the instructions laid out in https://github.com/rust-lang/miri/issues/707#issuecomment-561564057 , and is yet a work in progress.
### STATUS
- [x] Add general **_target_** methods for **read_str/alloc_str** that dispatch to either **c_str** or **wide_str** variants
(**helpers.rs**)
- [x] Implement shims `fn getenvironmentvariablew`/`fn setenvironmentvariablew`
(`std::env::var()`, `std::env::set_var()`)
- [x] Implement shim `GetEnvironmentStringsW` (`std::env::vars()`)
- [x] Implement shim `FreeEnvironmentStringsW`
### ISSUES (updated on 03/21/2020)
- MIRI errors while running `std::env::remove_var()` in Windows.
MIRI complaining about raw pointer usage in
Rust standard library [*src/libstd/sys/windows/os.rs*](https://github.com/rust-lang/miri/pull/1225#issuecomment-602100146).
### TODO (probably on a separate PR)
- Move string helpers into a new file to avoid bloating **src/helpers.rs** too much. (**shims/os_str.rs**)