]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #1225 - JOE1994:rw_widestr, r=RalfJung
authorbors <bors@rust-lang.org>
Fri, 27 Mar 2020 19:38:41 +0000 (19:38 +0000)
committerbors <bors@rust-lang.org>
Fri, 27 Mar 2020 19:38:41 +0000 (19:38 +0000)
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**)


Trivial merge