about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorFlying-Toast <38232168+Flying-Toast@users.noreply.github.com>2020-09-08 22:26:44 -0400
committerFlying-Toast <38232168+Flying-Toast@users.noreply.github.com>2020-09-08 22:26:44 -0400
commitc66789d572ab3d950bc187d3bca3bc0042023358 (patch)
tree26872b4ec4e3140cb54b9b68ea4c389d0f9112af /library/std/src
parent90782cb50ba6d1f2ea97cf74a3b06eca6bef8b59 (diff)
downloadrust-c66789d572ab3d950bc187d3bca3bc0042023358.tar.gz
rust-c66789d572ab3d950bc187d3bca3bc0042023358.zip
Capitalize safety comments
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/alloc.rs2
-rw-r--r--library/std/src/ffi/c_str.rs4
-rw-r--r--library/std/src/ffi/os_str.rs4
-rw-r--r--library/std/src/lazy.rs6
-rw-r--r--library/std/src/sys/windows/os_str.rs4
-rw-r--r--library/std/src/sys_common/os_str_bytes.rs4
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) }