Auto merge of #29252 - steveklabnik:safety, r=alexcrichton
Follow https://doc.rust-lang.org/book/documentation.html#special-sections
This commit is contained in:
commit
8d41c6fc0a
@ -254,7 +254,7 @@ pub fn as_ptr(&self) -> *const u8 {
|
||||
///
|
||||
/// Returns the substring from [`begin`..`end`).
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// Caller must check both UTF-8 sequence boundaries and the boundaries
|
||||
/// of the entire slice as well.
|
||||
|
@ -361,7 +361,7 @@ pub fn from_utf16_lossy(v: &[u16]) -> String {
|
||||
|
||||
/// Creates a new `String` from a length, capacity, and pointer.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This is _very_ unsafe because:
|
||||
///
|
||||
@ -385,7 +385,7 @@ pub unsafe fn from_raw_parts(buf: *mut u8, length: usize, capacity: usize) -> St
|
||||
///
|
||||
/// [fromutf8]: struct.String.html#method.from_utf8
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because it does not check that the bytes passed to
|
||||
/// it are valid UTF-8. If this constraint is violated, undefined behavior
|
||||
|
@ -284,7 +284,7 @@ pub fn with_capacity(capacity: usize) -> Vec<T> {
|
||||
|
||||
/// Creates a `Vec<T>` directly from the raw components of another vector.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This is highly unsafe, due to the number of invariants that aren't
|
||||
/// checked:
|
||||
|
@ -214,7 +214,7 @@ pub fn set(&self, value: T) {
|
||||
|
||||
/// Returns a reference to the underlying `UnsafeCell`.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is `unsafe` because `UnsafeCell`'s field is public.
|
||||
///
|
||||
@ -813,7 +813,7 @@ pub const fn new(value: T) -> UnsafeCell<T> {
|
||||
|
||||
/// Unwraps the value.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because this thread or another thread may currently be
|
||||
/// inspecting the inner value.
|
||||
|
@ -1435,7 +1435,7 @@ pub fn mut_ref_slice<A>(s: &mut A) -> &mut [A] {
|
||||
///
|
||||
/// The `len` argument is the number of **elements**, not the number of bytes.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer is
|
||||
/// valid for `len` elements, nor whether the lifetime inferred is a suitable
|
||||
|
@ -247,7 +247,7 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
|
||||
///
|
||||
/// [fromutf8]: fn.from_utf8.html
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because it does not check that the bytes passed to
|
||||
/// it are valid UTF-8. If this constraint is violated, undefined behavior
|
||||
|
@ -6163,7 +6163,7 @@ pub mod stdlib {
|
||||
|
||||
/// Exits the running program in a possibly dangerous manner.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// While this forces your program to exit, it does so in a way that has
|
||||
/// consequences. This will skip all unwinding code, which means that anything
|
||||
|
Loading…
Reference in New Issue
Block a user