diff options
| author | bors <bors@rust-lang.org> | 2020-03-29 00:56:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-03-29 00:56:47 +0000 |
| commit | 150322f86d441752874a8bed603d71119f190b8b (patch) | |
| tree | 54c8b39ae7352cc7096ca57402d0094876df6c6b /src/libstd/sys | |
| parent | 77621317d643cc5d13da60b26ab68b057668e688 (diff) | |
| parent | be8d896a4e7a7f87d7a4f418bfb4a8fb2d8d1abe (diff) | |
| download | rust-150322f86d441752874a8bed603d71119f190b8b.tar.gz rust-150322f86d441752874a8bed603d71119f190b8b.zip | |
Auto merge of #70518 - Dylan-DPC:rollup-n2gkh3a, r=Dylan-DPC
Rollup of 5 pull requests
Successful merges:
- #69937 (ASCII methods on OsStr)
- #70235 (Validate git setup before accessing functionality)
- #70503 (rename Scalar::{ptr_null -> null_ptr} and add "machine_" prefix like elsewhere)
- #70508 (Miri: use more specialized Scalar::from_ constructors where appropriate)
- #70510 (fix TryEnterCriticalSection return type)
Failed merges:
r? @ghost
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/windows/c.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/windows/os_str.rs | 30 | ||||
| -rw-r--r-- | src/libstd/sys/windows/process.rs | 9 |
3 files changed, 35 insertions, 6 deletions
diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 7f93ef87953..134f508dfab 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -778,7 +778,7 @@ extern "system" { pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int; pub fn InitializeCriticalSection(CriticalSection: *mut CRITICAL_SECTION); pub fn EnterCriticalSection(CriticalSection: *mut CRITICAL_SECTION); - pub fn TryEnterCriticalSection(CriticalSection: *mut CRITICAL_SECTION) -> BOOLEAN; + pub fn TryEnterCriticalSection(CriticalSection: *mut CRITICAL_SECTION) -> BOOL; pub fn LeaveCriticalSection(CriticalSection: *mut CRITICAL_SECTION); pub fn DeleteCriticalSection(CriticalSection: *mut CRITICAL_SECTION); diff --git a/src/libstd/sys/windows/os_str.rs b/src/libstd/sys/windows/os_str.rs index ff6885cb274..6aab028873e 100644 --- a/src/libstd/sys/windows/os_str.rs +++ b/src/libstd/sys/windows/os_str.rs @@ -179,4 +179,34 @@ impl Slice { let rc = self.inner.into_rc(); unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Slice) } } + + #[inline] + pub fn make_ascii_lowercase(&mut self) { + self.inner.make_ascii_lowercase() + } + + #[inline] + pub fn make_ascii_uppercase(&mut self) { + self.inner.make_ascii_uppercase() + } + + #[inline] + pub fn to_ascii_lowercase(&self) -> Buf { + Buf { inner: self.inner.to_ascii_lowercase() } + } + + #[inline] + pub fn to_ascii_uppercase(&self) -> Buf { + Buf { inner: self.inner.to_ascii_uppercase() } + } + + #[inline] + pub fn is_ascii(&self) -> bool { + self.inner.is_ascii() + } + + #[inline] + pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool { + self.inner.eq_ignore_ascii_case(&other.inner) + } } diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index a62a637393e..77f9a5c9dc7 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -20,7 +20,7 @@ use crate::sys::mutex::Mutex; use crate::sys::pipe::{self, AnonPipe}; use crate::sys::stdio; use crate::sys_common::process::CommandEnv; -use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::sys_common::AsInner; use libc::{c_void, EXIT_FAILURE, EXIT_SUCCESS}; @@ -33,10 +33,9 @@ use libc::{c_void, EXIT_FAILURE, EXIT_SUCCESS}; pub struct EnvKey(OsString); impl From<OsString> for EnvKey { - fn from(k: OsString) -> Self { - let mut buf = k.into_inner().into_inner(); - buf.make_ascii_uppercase(); - EnvKey(FromInner::from_inner(FromInner::from_inner(buf))) + fn from(mut k: OsString) -> Self { + k.make_ascii_uppercase(); + EnvKey(k) } } |
