Add shims for env var emulation in Windows#1225
Conversation
That sounds like a good idea, do you want to do that in a separate PR? |
It's actually the idea that you suggested last year 😃 I will open a separate PR to take care of it after this PR is merged. |
This comment has been minimized.
This comment has been minimized.
|
|
|
☔ The latest upstream changes (presumably #1250) made this pull request unmergeable. Please resolve the merge conflicts. |
72aa9c2 to
3bb5d85
Compare
Co-Authored-By: Ralf Jung <post@ralfj.de>
|
Okay, I think the code is fine now except for that |
|
Ah I forgot, there are some more tests that can have their "ignore-windows" removed:
Also, in tests/compile-fail/environ-gets-deallocated.rs, the comment should be updated to something like |
|
All right, thanks for your persistence and well done. :) |
|
📌 Commit 579b3c4 has been approved by |
|
☀️ Test successful - checks-travis, status-appveyor |
avoid creating unnecessary reference in Windows Env iterator Discovered in rust-lang/miri#1225: the Windows `Env` iterator violates Stacked Borrows by creating an `&u16`, turning it into a raw pointer, and then accessing memory outside the range of that type. There is no need to create a reference here in the first place, so the fix is trivial. Cc @JOE1994 Cc rust-lang/unsafe-code-guidelines#134
A small fix was made to libstd in rust-lang/rust#70479 (back in March). (Miri reported UB due to Stacked Borrows violation - [link to Miri error log](rust-lang#1225 (comment))) Thank you for reviewing 👍
Add a case to list of 'StackedBorrows violations' A small fix was made to libstd in rust-lang/rust#70479 (back in March). (Miri reported UB due to Stacked Borrows violation - [link to Miri error log](#1225 (comment))) Thank you for reviewing 👍

This PR attempts to implement the final step of the instructions laid out in #707 (comment) , and is yet a work in progress.
STATUS
(helpers.rs)
fn getenvironmentvariablew/fn setenvironmentvariablew(
std::env::var(),std::env::set_var())GetEnvironmentStringsW(std::env::vars())FreeEnvironmentStringsWISSUES (updated on 03/21/2020)
std::env::remove_var()in Windows.MIRI complaining about raw pointer usage in
Rust standard library src/libstd/sys/windows/os.rs.
TODO (probably on a separate PR)