Rollup merge of #44072 - lukaramu:fix-doc-headings, r=steveklabnik
Fix inconsistent doc headings This fixes headings reading "Unsafety" and "Example", they should be "Safety" and "Examples" according to RFC 1574. r? @steveklabnik
This commit is contained in:
commit
7e8753d1c1
@ -110,7 +110,7 @@ impl Layout {
|
||||
|
||||
/// Creates a layout, bypassing all checks.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as it does not verify that `align` is
|
||||
/// a power-of-two that is also less than or equal to 2^31, nor
|
||||
@ -485,7 +485,7 @@ pub unsafe trait Alloc {
|
||||
/// behavior, e.g. to ensure initialization to particular sets of
|
||||
/// bit patterns.)
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because undefined behavior can result
|
||||
/// if the caller does not ensure that `layout` has non-zero size.
|
||||
@ -513,7 +513,7 @@ pub unsafe trait Alloc {
|
||||
|
||||
/// Deallocate the memory referenced by `ptr`.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because undefined behavior can result
|
||||
/// if the caller does not ensure all of the following:
|
||||
@ -617,7 +617,7 @@ pub unsafe trait Alloc {
|
||||
/// behavior is well-defined (though underspecified) when this
|
||||
/// constraint is violated; further discussion below.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because undefined behavior can result
|
||||
/// if the caller does not ensure all of the following:
|
||||
@ -688,7 +688,7 @@ pub unsafe trait Alloc {
|
||||
/// Behaves like `alloc`, but also ensures that the contents
|
||||
/// are set to zero before being returned.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe for the same reasons that `alloc` is.
|
||||
///
|
||||
@ -714,7 +714,7 @@ pub unsafe trait Alloc {
|
||||
/// the returned block. For some `layout` inputs, like arrays, this
|
||||
/// may include extra storage usable for additional data.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe for the same reasons that `alloc` is.
|
||||
///
|
||||
@ -736,7 +736,7 @@ pub unsafe trait Alloc {
|
||||
/// the returned block. For some `layout` inputs, like arrays, this
|
||||
/// may include extra storage usable for additional data.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe for the same reasons that `realloc` is.
|
||||
///
|
||||
@ -770,7 +770,7 @@ pub unsafe trait Alloc {
|
||||
/// memory block referenced by `ptr` has not been transferred, and
|
||||
/// the contents of the memory block are unaltered.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because undefined behavior can result
|
||||
/// if the caller does not ensure all of the following:
|
||||
@ -827,7 +827,7 @@ pub unsafe trait Alloc {
|
||||
/// the memory block has not been transferred, and the contents of
|
||||
/// the memory block are unaltered.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because undefined behavior can result
|
||||
/// if the caller does not ensure all of the following:
|
||||
@ -920,7 +920,7 @@ pub unsafe trait Alloc {
|
||||
///
|
||||
/// Captures a common usage pattern for allocators.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because undefined behavior can result
|
||||
/// if the caller does not ensure both:
|
||||
@ -993,7 +993,7 @@ pub unsafe trait Alloc {
|
||||
/// The returned block is suitable for passing to the
|
||||
/// `alloc`/`realloc` methods of this allocator.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because undefined behavior can result
|
||||
/// if the caller does not ensure all of the following:
|
||||
@ -1037,7 +1037,7 @@ pub unsafe trait Alloc {
|
||||
///
|
||||
/// Captures a common usage pattern for allocators.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe because undefined behavior can result
|
||||
/// if the caller does not ensure both:
|
||||
|
@ -633,7 +633,7 @@ impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {}
|
||||
/// that `FnBox` may be deprecated in the future if `Box<FnOnce()>`
|
||||
/// closures become directly usable.)
|
||||
///
|
||||
/// ### Example
|
||||
/// # Examples
|
||||
///
|
||||
/// Here is a snippet of code which creates a hashmap full of boxed
|
||||
/// once closures and then removes them one by one, calling each
|
||||
|
@ -171,7 +171,7 @@ mod hack {
|
||||
impl<T> [T] {
|
||||
/// Returns the number of elements in the slice.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let a = [1, 2, 3];
|
||||
@ -185,7 +185,7 @@ impl<T> [T] {
|
||||
|
||||
/// Returns `true` if the slice has a length of 0.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let a = [1, 2, 3];
|
||||
@ -523,7 +523,7 @@ impl<T> [T] {
|
||||
|
||||
/// Reverses the order of elements in the slice, in place.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let mut v = [1, 2, 3];
|
||||
@ -580,7 +580,7 @@ impl<T> [T] {
|
||||
///
|
||||
/// Panics if `size` is 0.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let slice = ['r', 'u', 's', 't'];
|
||||
@ -613,7 +613,7 @@ impl<T> [T] {
|
||||
///
|
||||
/// Panics if `size` is 0.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let slice = ['l', 'o', 'r', 'e', 'm'];
|
||||
@ -1040,7 +1040,7 @@ impl<T> [T] {
|
||||
/// `Err` is returned, containing the index where a matching
|
||||
/// element could be inserted while maintaining sorted order.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// Looks up a series of four elements. The first is found, with a
|
||||
/// uniquely determined position; the second and third are not
|
||||
@ -1074,7 +1074,7 @@ impl<T> [T] {
|
||||
/// `Err` is returned, containing the index where a matching
|
||||
/// element could be inserted while maintaining sorted order.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// Looks up a series of four elements. The first is found, with a
|
||||
/// uniquely determined position; the second and third are not
|
||||
@ -1419,7 +1419,7 @@ impl<T> [T] {
|
||||
///
|
||||
/// This function will panic if the two slices have different lengths.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let mut dst = [0, 0, 0];
|
||||
@ -1445,7 +1445,7 @@ impl<T> [T] {
|
||||
///
|
||||
/// This function will panic if the two slices have different lengths.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let mut dst = [0, 0, 0];
|
||||
|
@ -1714,7 +1714,7 @@ impl str {
|
||||
///
|
||||
/// [`Err`]: str/trait.FromStr.html#associatedtype.Err
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage
|
||||
///
|
||||
|
@ -998,7 +998,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
|
||||
/// A method would interfere with methods of the same name on the contents
|
||||
/// of a `RefCell` used through `Deref`.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::cell::{RefCell, Ref};
|
||||
@ -1040,7 +1040,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
|
||||
/// `RefMut::map(...)`. A method would interfere with methods of the same
|
||||
/// name on the contents of a `RefCell` used through `Deref`.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::cell::{RefCell, RefMut};
|
||||
|
@ -58,7 +58,7 @@ impl<'a, 'b: 'a> fmt::Write for PadAdapter<'a, 'b> {
|
||||
/// [`Formatter::debug_struct`](struct.Formatter.html#method.debug_struct)
|
||||
/// method.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fmt;
|
||||
@ -153,7 +153,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
|
||||
/// [`Formatter::debug_tuple`](struct.Formatter.html#method.debug_tuple)
|
||||
/// method.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fmt;
|
||||
@ -290,7 +290,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
|
||||
/// [`Formatter::debug_set`](struct.Formatter.html#method.debug_set)
|
||||
/// method.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fmt;
|
||||
@ -361,7 +361,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
|
||||
/// [`Formatter::debug_list`](struct.Formatter.html#method.debug_list)
|
||||
/// method.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fmt;
|
||||
@ -432,7 +432,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {
|
||||
/// [`Formatter::debug_map`](struct.Formatter.html#method.debug_map)
|
||||
/// method.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fmt;
|
||||
|
@ -901,7 +901,7 @@ impl<T> ManuallyDrop<T> {
|
||||
|
||||
/// Manually drops the contained value.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This function runs the destructor of the contained value and thus the wrapped value
|
||||
/// now represents uninitialized data. It is up to the user of this method to ensure the
|
||||
|
@ -522,7 +522,7 @@ pub trait Read {
|
||||
/// `Read`er - the method only takes `&self` so that it can be used through
|
||||
/// trait objects.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This method is unsafe because a `Read`er could otherwise return a
|
||||
/// non-zeroing `Initializer` from another `Read` type without an `unsafe`
|
||||
@ -903,7 +903,7 @@ impl Initializer {
|
||||
|
||||
/// Returns a new `Initializer` which will not zero out buffers.
|
||||
///
|
||||
/// # Unsafety
|
||||
/// # Safety
|
||||
///
|
||||
/// This may only be called by `Read`ers which guarantee that they will not
|
||||
/// read from buffers passed to `Read` methods, and that the return value of
|
||||
|
@ -20,7 +20,7 @@
|
||||
/// magnitude faster than `haystack.iter().position(|&b| b == needle)`.
|
||||
/// (See benchmarks.)
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// This shows how to find the first position of a byte in a byte string.
|
||||
///
|
||||
@ -40,7 +40,7 @@ pub fn memchr(needle: u8, haystack: &[u8]) -> Option<usize> {
|
||||
/// Returns the index corresponding to the last occurrence of `needle` in
|
||||
/// `haystack`, or `None` if one is not found.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// This shows how to find the last position of a byte in a byte string.
|
||||
///
|
||||
|
@ -13,7 +13,7 @@
|
||||
//! For now, this module is limited to extracting file descriptors,
|
||||
//! but its functionality will grow over time.
|
||||
//!
|
||||
//! # Example
|
||||
//! # Examples
|
||||
//!
|
||||
//! ```no_run
|
||||
//! use std::fs::File;
|
||||
|
@ -13,7 +13,7 @@
|
||||
//! For now, this module is limited to extracting file descriptors,
|
||||
//! but its functionality will grow over time.
|
||||
//!
|
||||
//! # Example
|
||||
//! # Examples
|
||||
//!
|
||||
//! ```no_run
|
||||
//! use std::fs::File;
|
||||
|
@ -807,7 +807,7 @@ pub fn park_timeout_ms(ms: u32) {
|
||||
/// Platforms which do not support nanosecond precision for sleeping will have
|
||||
/// `dur` rounded up to the nearest granularity of time they can sleep for.
|
||||
///
|
||||
/// # Example
|
||||
/// # Examples
|
||||
///
|
||||
/// Waiting for the complete expiration of the timeout:
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user