diff options
| author | bors <bors@rust-lang.org> | 2020-09-09 22:17:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-09-09 22:17:42 +0000 |
| commit | 97eb606e4b2becd17d46a67d87169f52b210e67c (patch) | |
| tree | 7a8f83e2ca64a5f2225f4476ef4a61de8e4e8a2d /library/std/src | |
| parent | e2be5f568d1f60365b825530f5b5cb722460591b (diff) | |
| parent | 32714eb6bc3cbfe48774e85472ad8431fba3c7c8 (diff) | |
| download | rust-97eb606e4b2becd17d46a67d87169f52b210e67c.tar.gz rust-97eb606e4b2becd17d46a67d87169f52b210e67c.zip | |
Auto merge of #76540 - tmandry:rollup-5ogt8x0, r=tmandry
Rollup of 14 pull requests Successful merges: - #75094 (Add `-Z combine_cgu` flag) - #75984 (Improve unresolved use error message) - #76141 (Address review comments about config.toml from rustc-dev-guide PR) - #76313 (Improved the MIR spanview output) - #76430 (Add align to rustc-attrs unstable book) - #76465 (Add a script to automatically update Rust/Clang versions in documentation) - #76473 (Add missed spaces to GCC-WARNING.txt) - #76481 (Convert repetitive target_pointer_width checks to const solution.) - #76493 (Remove a stray ignore-tidy-undocumented-unsafe) - #76504 (Capitalize safety comments) - #76515 (SessionDiagnostic: Fix non-determinism in generated format string.) - #76516 (Enable GitHub Releases synchronization) - #76522 (remove redundant clones) - #76523 (Remove unused PlaceContext::NonUse(NonUseContext::Coverage)) Failed merges: r? `@ghost`
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/alloc.rs | 2 | ||||
| -rw-r--r-- | library/std/src/ffi/c_str.rs | 4 | ||||
| -rw-r--r-- | library/std/src/ffi/os_str.rs | 4 | ||||
| -rw-r--r-- | library/std/src/lazy.rs | 6 | ||||
| -rw-r--r-- | library/std/src/sys/windows/os_str.rs | 4 | ||||
| -rw-r--r-- | library/std/src/sys_common/os_str_bytes.rs | 4 |
6 files changed, 12 insertions, 12 deletions
diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs index 64d8edf33bd..770c97899f0 100644 --- a/library/std/src/alloc.rs +++ b/library/std/src/alloc.rs @@ -149,7 +149,7 @@ impl System { } } - // Safety: Same as `AllocRef::grow` + // SAFETY: Same as `AllocRef::grow` #[inline] unsafe fn grow_impl( &mut self, diff --git a/library/std/src/ffi/c_str.rs b/library/std/src/ffi/c_str.rs index 51deb217c7c..13021738af1 100644 --- a/library/std/src/ffi/c_str.rs +++ b/library/std/src/ffi/c_str.rs @@ -881,13 +881,13 @@ impl From<Vec<NonZeroU8>> for CString { unsafe { // Transmute `Vec<NonZeroU8>` to `Vec<u8>`. let v: Vec<u8> = { - // Safety: + // SAFETY: // - transmuting between `NonZeroU8` and `u8` is sound; // - `alloc::Layout<NonZeroU8> == alloc::Layout<u8>`. let (ptr, len, cap): (*mut NonZeroU8, _, _) = Vec::into_raw_parts(v); Vec::from_raw_parts(ptr.cast::<u8>(), len, cap) }; - // Safety: `v` cannot contain null bytes, given the type-level + // SAFETY: `v` cannot contain null bytes, given the type-level // invariant of `NonZeroU8`. CString::from_vec_unchecked(v) } diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index e0be6d1c836..c83e996634c 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -510,14 +510,14 @@ impl OsStr { #[inline] fn from_inner(inner: &Slice) -> &OsStr { - // Safety: OsStr is just a wrapper of Slice, + // SAFETY: OsStr is just a wrapper of Slice, // therefore converting &Slice to &OsStr is safe. unsafe { &*(inner as *const Slice as *const OsStr) } } #[inline] fn from_inner_mut(inner: &mut Slice) -> &mut OsStr { - // Safety: OsStr is just a wrapper of Slice, + // SAFETY: OsStr is just a wrapper of Slice, // therefore converting &mut Slice to &mut OsStr is safe. // Any method that mutates OsStr must be careful not to // break platform-specific encoding, in particular Wtf8 on Windows. diff --git a/library/std/src/lazy.rs b/library/std/src/lazy.rs index d171231b0f1..091e2091fb0 100644 --- a/library/std/src/lazy.rs +++ b/library/std/src/lazy.rs @@ -293,7 +293,7 @@ impl<T> SyncOnceCell<T> { debug_assert!(self.is_initialized()); - // Safety: The inner value has been initialized + // SAFETY: The inner value has been initialized Ok(unsafe { self.get_unchecked() }) } @@ -316,7 +316,7 @@ impl<T> SyncOnceCell<T> { /// ``` #[unstable(feature = "once_cell", issue = "74465")] pub fn into_inner(mut self) -> Option<T> { - // Safety: Safe because we immediately free `self` without dropping + // SAFETY: Safe because we immediately free `self` without dropping let inner = unsafe { self.take_inner() }; // Don't drop this `SyncOnceCell`. We just moved out one of the fields, but didn't set @@ -416,7 +416,7 @@ impl<T> SyncOnceCell<T> { unsafe impl<#[may_dangle] T> Drop for SyncOnceCell<T> { fn drop(&mut self) { - // Safety: The cell is being dropped, so it can't be accessed again. + // SAFETY: The cell is being dropped, so it can't be accessed again. // We also don't touch the `T`, which validates our usage of #[may_dangle]. unsafe { self.take_inner() }; } diff --git a/library/std/src/sys/windows/os_str.rs b/library/std/src/sys/windows/os_str.rs index 2f5fc72ab44..7e09a4fd561 100644 --- a/library/std/src/sys/windows/os_str.rs +++ b/library/std/src/sys/windows/os_str.rs @@ -77,14 +77,14 @@ impl Buf { } pub fn as_slice(&self) -> &Slice { - // Safety: Slice is just a wrapper for Wtf8, + // SAFETY: Slice is just a wrapper for Wtf8, // and self.inner.as_slice() returns &Wtf8. // Therefore, transmuting &Wtf8 to &Slice is safe. unsafe { mem::transmute(self.inner.as_slice()) } } pub fn as_mut_slice(&mut self) -> &mut Slice { - // Safety: Slice is just a wrapper for Wtf8, + // SAFETY: Slice is just a wrapper for Wtf8, // and self.inner.as_mut_slice() returns &mut Wtf8. // Therefore, transmuting &mut Wtf8 to &mut Slice is safe. // Additionally, care should be taken to ensure the slice diff --git a/library/std/src/sys_common/os_str_bytes.rs b/library/std/src/sys_common/os_str_bytes.rs index 323165cda6b..497e5fc7bdd 100644 --- a/library/std/src/sys_common/os_str_bytes.rs +++ b/library/std/src/sys_common/os_str_bytes.rs @@ -106,7 +106,7 @@ impl Buf { #[inline] pub fn as_slice(&self) -> &Slice { - // Safety: Slice just wraps [u8], + // SAFETY: Slice just wraps [u8], // and &*self.inner is &[u8], therefore // transmuting &[u8] to &Slice is safe. unsafe { mem::transmute(&*self.inner) } @@ -114,7 +114,7 @@ impl Buf { #[inline] pub fn as_mut_slice(&mut self) -> &mut Slice { - // Safety: Slice just wraps [u8], + // SAFETY: Slice just wraps [u8], // and &mut *self.inner is &mut [u8], therefore // transmuting &mut [u8] to &mut Slice is safe. unsafe { mem::transmute(&mut *self.inner) } |
