diff options
| author | bors <bors@rust-lang.org> | 2019-09-06 07:37:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-06 07:37:41 +0000 |
| commit | 1fb3c4ec7ca37d33bd1e68cce669d171c2752615 (patch) | |
| tree | 48ea5150538790309c68b9f515c4e958724a82a5 /src/libstd/sys/windows | |
| parent | 6b5f9b2e973e438fc1726a2d164d046acd80b170 (diff) | |
| parent | 61fcd057d2524175a21e2eb1d49c1d4aec29a0be (diff) | |
| download | rust-1fb3c4ec7ca37d33bd1e68cce669d171c2752615.tar.gz rust-1fb3c4ec7ca37d33bd1e68cce669d171c2752615.zip | |
Auto merge of #64209 - Centril:rollup-x9kvjb7, r=Centril
Rollup of 10 pull requests Successful merges: - #63676 (Use wasi crate for Core API) - #64094 (Improve searching in rustdoc and add tests) - #64111 (or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve) - #64156 (Assume non-git LLVM is fresh if the stamp file exists) - #64161 (Point at variant on pattern field count mismatch) - #64174 (Add missing code examples on Iterator trait) - #64175 (Fix invalid span generation when it should be div) - #64186 (std: Improve downstream codegen in `Command::env`) - #64190 (fill metadata in rustc_lexer's Cargo.toml) - #64198 (Add Fuchsia to actually_monotonic) Failed merges: r? @ghost
Diffstat (limited to 'src/libstd/sys/windows')
| -rw-r--r-- | src/libstd/sys/windows/process.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 05e0ca67064..8658deb8546 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -19,7 +19,7 @@ use crate::sys::pipe::{self, AnonPipe}; use crate::sys::stdio; use crate::sys::cvt; use crate::sys_common::{AsInner, FromInner, IntoInner}; -use crate::sys_common::process::{CommandEnv, EnvKey}; +use crate::sys_common::process::CommandEnv; use crate::borrow::Borrow; use libc::{c_void, EXIT_SUCCESS, EXIT_FAILURE}; @@ -30,30 +30,28 @@ use libc::{c_void, EXIT_SUCCESS, EXIT_FAILURE}; #[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] #[doc(hidden)] -pub struct WindowsEnvKey(OsString); +pub struct EnvKey(OsString); -impl From<OsString> for WindowsEnvKey { +impl From<OsString> for EnvKey { fn from(k: OsString) -> Self { let mut buf = k.into_inner().into_inner(); buf.make_ascii_uppercase(); - WindowsEnvKey(FromInner::from_inner(FromInner::from_inner(buf))) + EnvKey(FromInner::from_inner(FromInner::from_inner(buf))) } } -impl From<WindowsEnvKey> for OsString { - fn from(k: WindowsEnvKey) -> Self { k.0 } +impl From<EnvKey> for OsString { + fn from(k: EnvKey) -> Self { k.0 } } -impl Borrow<OsStr> for WindowsEnvKey { +impl Borrow<OsStr> for EnvKey { fn borrow(&self) -> &OsStr { &self.0 } } -impl AsRef<OsStr> for WindowsEnvKey { +impl AsRef<OsStr> for EnvKey { fn as_ref(&self) -> &OsStr { &self.0 } } -impl EnvKey for WindowsEnvKey {} - fn ensure_no_nuls<T: AsRef<OsStr>>(str: T) -> io::Result<T> { if str.as_ref().encode_wide().any(|b| b == 0) { @@ -66,7 +64,7 @@ fn ensure_no_nuls<T: AsRef<OsStr>>(str: T) -> io::Result<T> { pub struct Command { program: OsString, args: Vec<OsString>, - env: CommandEnv<WindowsEnvKey>, + env: CommandEnv, cwd: Option<OsString>, flags: u32, detach: bool, // not currently exposed in std::process @@ -110,7 +108,7 @@ impl Command { pub fn arg(&mut self, arg: &OsStr) { self.args.push(arg.to_os_string()) } - pub fn env_mut(&mut self) -> &mut CommandEnv<WindowsEnvKey> { + pub fn env_mut(&mut self) -> &mut CommandEnv { &mut self.env } pub fn cwd(&mut self, dir: &OsStr) { @@ -498,7 +496,7 @@ fn make_command_line(prog: &OsStr, args: &[OsString]) -> io::Result<Vec<u16>> { } } -fn make_envp(maybe_env: Option<BTreeMap<WindowsEnvKey, OsString>>) +fn make_envp(maybe_env: Option<BTreeMap<EnvKey, OsString>>) -> io::Result<(*mut c_void, Vec<u16>)> { // On Windows we pass an "environment block" which is not a char**, but // rather a concatenation of null-terminated k=v\0 sequences, with a final |
