tests: doc comments
This commit is contained in:
parent
c3e182cf43
commit
b87363e763
61 changed files with 164 additions and 164 deletions
|
@ -50,11 +50,11 @@ pub const CAPACITY: usize = 2 * B - 1;
|
|||
///
|
||||
/// We have a separate type for the header and rely on it matching the prefix of `LeafNode`, in
|
||||
/// order to statically allocate a single dummy node to avoid allocations. This struct is
|
||||
/// `repr(C)` to prevent them from being reordered. `LeafNode` does not just contain a
|
||||
/// `repr(C)` to prevent them from being reordered. `LeafNode` does not just contain a
|
||||
/// `NodeHeader` because we do not want unnecessary padding between `len` and the keys.
|
||||
/// Crucially, `NodeHeader` can be safely transmuted to different K and V. (This is exploited
|
||||
/// Crucially, `NodeHeader` can be safely transmuted to different K and V. (This is exploited
|
||||
/// by `as_header`.)
|
||||
/// See `into_key_slice` for an explanation of K2. K2 cannot be safely transmuted around
|
||||
/// See `into_key_slice` for an explanation of K2. K2 cannot be safely transmuted around
|
||||
/// because the size of `NodeHeader` depends on its alignment!
|
||||
#[repr(C)]
|
||||
struct NodeHeader<K, V, K2 = ()> {
|
||||
|
|
|
@ -1922,7 +1922,7 @@ impl<T> VecDeque<T> {
|
|||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// If `mid` is greater than `len()`. Note that `mid == len()`
|
||||
/// If `mid` is greater than `len()`. Note that `mid == len()`
|
||||
/// does _not_ panic and is a no-op rotation.
|
||||
///
|
||||
/// # Complexity
|
||||
|
@ -1967,7 +1967,7 @@ impl<T> VecDeque<T> {
|
|||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// If `k` is greater than `len()`. Note that `k == len()`
|
||||
/// If `k` is greater than `len()`. Note that `k == len()`
|
||||
/// does _not_ panic and is a no-op rotation.
|
||||
///
|
||||
/// # Complexity
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
//! will then parse the format string and determine if the list of arguments
|
||||
//! provided is suitable to pass to this format string.
|
||||
//!
|
||||
//! To convert a single value to a string, use the [`to_string`] method. This
|
||||
//! To convert a single value to a string, use the [`to_string`] method. This
|
||||
//! will use the [`Display`] formatting trait.
|
||||
//!
|
||||
//! ## Positional parameters
|
||||
|
@ -102,7 +102,7 @@
|
|||
//! When requesting that an argument be formatted with a particular type, you
|
||||
//! are actually requesting that an argument ascribes to a particular trait.
|
||||
//! This allows multiple actual types to be formatted via `{:x}` (like [`i8`] as
|
||||
//! well as [`isize`]). The current mapping of types to traits is:
|
||||
//! well as [`isize`]). The current mapping of types to traits is:
|
||||
//!
|
||||
//! * *nothing* ⇒ [`Display`]
|
||||
//! * `?` ⇒ [`Debug`]
|
||||
|
@ -427,7 +427,7 @@
|
|||
//! 3. An asterisk `.*`:
|
||||
//!
|
||||
//! `.*` means that this `{...}` is associated with *two* format inputs rather than one: the
|
||||
//! first input holds the `usize` precision, and the second holds the value to print. Note that
|
||||
//! first input holds the `usize` precision, and the second holds the value to print. Note that
|
||||
//! in this case, if one uses the format string `{<arg>:<spec>.*}`, then the `<arg>` part refers
|
||||
//! to the *value* to print, and the `precision` must come in the input preceding `<arg>`.
|
||||
//!
|
||||
|
|
|
@ -62,8 +62,8 @@ macro_rules! vec {
|
|||
|
||||
/// Creates a `String` using interpolation of runtime expressions.
|
||||
///
|
||||
/// The first argument `format!` receives is a format string. This must be a string
|
||||
/// literal. The power of the formatting string is in the `{}`s contained.
|
||||
/// The first argument `format!` receives is a format string. This must be a string
|
||||
/// literal. The power of the formatting string is in the `{}`s contained.
|
||||
///
|
||||
/// Additional parameters passed to `format!` replace the `{}`s within the
|
||||
/// formatting string in the order given unless named or positional parameters
|
||||
|
@ -73,7 +73,7 @@ macro_rules! vec {
|
|||
/// The same convention is used with [`print!`] and [`write!`] macros,
|
||||
/// depending on the intended destination of the string.
|
||||
///
|
||||
/// To convert a single value to a string, use the [`to_string`] method. This
|
||||
/// To convert a single value to a string, use the [`to_string`] method. This
|
||||
/// will use the [`Display`] formatting trait.
|
||||
///
|
||||
/// [fmt]: ../std/fmt/index.html
|
||||
|
|
|
@ -738,7 +738,7 @@ impl<T> Vec<T> {
|
|||
/// Forces the length of the vector to `new_len`.
|
||||
///
|
||||
/// This is a low-level operation that maintains none of the normal
|
||||
/// invariants of the type. Normally changing the length of a vector
|
||||
/// invariants of the type. Normally changing the length of a vector
|
||||
/// is done using one of the safe operations instead, such as
|
||||
/// [`truncate`], [`resize`], [`extend`], or [`clear`].
|
||||
///
|
||||
|
|
|
@ -425,7 +425,7 @@ impl fmt::Display for CannotReallocInPlace {
|
|||
/// The `GlobalAlloc` trait is an `unsafe` trait for a number of reasons, and
|
||||
/// implementors must ensure that they adhere to these contracts:
|
||||
///
|
||||
/// * It's undefined behavior if global allocators unwind. This restriction may
|
||||
/// * It's undefined behavior if global allocators unwind. This restriction may
|
||||
/// be lifted in the future, but currently a panic from any of these
|
||||
/// functions may lead to memory unsafety.
|
||||
///
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
//!
|
||||
//! Consider a situation where we want to log out a value passed to a function.
|
||||
//! We know the value we're working on implements Debug, but we don't know its
|
||||
//! concrete type. We want to give special treatment to certain types: in this
|
||||
//! concrete type. We want to give special treatment to certain types: in this
|
||||
//! case printing out the length of String values prior to their value.
|
||||
//! We don't know the concrete type of our value at compile time, so we need to
|
||||
//! use runtime reflection instead.
|
||||
|
@ -31,8 +31,8 @@
|
|||
//! fn log<T: Any + Debug>(value: &T) {
|
||||
//! let value_any = value as &dyn Any;
|
||||
//!
|
||||
//! // try to convert our value to a String. If successful, we want to
|
||||
//! // output the String's length as well as its value. If not, it's a
|
||||
//! // Try to convert our value to a `String`. If successful, we want to
|
||||
//! // output the String`'s length as well as its value. If not, it's a
|
||||
//! // different type: just print it out unadorned.
|
||||
//! match value_any.downcast_ref::<String>() {
|
||||
//! Some(as_string) => {
|
||||
|
|
|
@ -1133,7 +1133,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
|
|||
/// The `RefCell` is already immutably borrowed, so this cannot fail.
|
||||
///
|
||||
/// This is an associated function that needs to be used as
|
||||
/// `Ref::clone(...)`. A `Clone` implementation or a method would interfere
|
||||
/// `Ref::clone(...)`. A `Clone` implementation or a method would interfere
|
||||
/// with the widespread use of `r.borrow().clone()` to clone the contents of
|
||||
/// a `RefCell`.
|
||||
#[stable(feature = "cell_extras", since = "1.15.0")]
|
||||
|
@ -1174,7 +1174,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Split a `Ref` into multiple `Ref`s for different components of the
|
||||
/// Splits a `Ref` into multiple `Ref`s for different components of the
|
||||
/// borrowed data.
|
||||
///
|
||||
/// The `RefCell` is already immutably borrowed, so this cannot fail.
|
||||
|
@ -1223,7 +1223,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
|
|||
/// The `RefCell` is already mutably borrowed, so this cannot fail.
|
||||
///
|
||||
/// This is an associated function that needs to be used as
|
||||
/// `RefMut::map(...)`. A method would interfere with methods of the same
|
||||
/// `RefMut::map(...)`. A method would interfere with methods of the same
|
||||
/// name on the contents of a `RefCell` used through `Deref`.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -1253,7 +1253,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Split a `RefMut` into multiple `RefMut`s for different components of the
|
||||
/// Splits a `RefMut` into multiple `RefMut`s for different components of the
|
||||
/// borrowed data.
|
||||
///
|
||||
/// The underlying `RefCell` will remain mutably borrowed until both
|
||||
|
|
|
@ -26,7 +26,7 @@ use self::Ordering::*;
|
|||
/// relations](http://en.wikipedia.org/wiki/Partial_equivalence_relation).
|
||||
///
|
||||
/// This trait allows for partial equality, for types that do not have a full
|
||||
/// equivalence relation. For example, in floating point numbers `NaN != NaN`,
|
||||
/// equivalence relation. For example, in floating point numbers `NaN != NaN`,
|
||||
/// so floating point types implement `PartialEq` but not `Eq`.
|
||||
///
|
||||
/// Formally, the equality must be (for all `a`, `b` and `c`):
|
||||
|
|
|
@ -217,7 +217,7 @@ pub trait AsMut<T: ?Sized> {
|
|||
///
|
||||
/// There is one exception to implementing `Into`, and it's kind of esoteric.
|
||||
/// If the destination type is not part of the current crate, and it uses a
|
||||
/// generic variable, then you can't implement `From` directly. For example,
|
||||
/// generic variable, then you can't implement `From` directly. For example,
|
||||
/// take this crate:
|
||||
///
|
||||
/// ```compile_fail
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! rustc compiler intrinsics.
|
||||
//! Compiler intrinsics.
|
||||
//!
|
||||
//! The corresponding definitions are in librustc_codegen_llvm/intrinsic.rs.
|
||||
//! The corresponding definitions are in `librustc_codegen_llvm/intrinsic.rs`.
|
||||
//!
|
||||
//! # Volatiles
|
||||
//!
|
||||
|
@ -697,7 +697,7 @@ extern "rust-intrinsic" {
|
|||
/// Creates a value initialized to zero.
|
||||
///
|
||||
/// `init` is unsafe because it returns a zeroed-out datum,
|
||||
/// which is unsafe unless T is `Copy`. Also, even if T is
|
||||
/// which is unsafe unless `T` is `Copy`. Also, even if T is
|
||||
/// `Copy`, an all-zero value may not correspond to any legitimate
|
||||
/// state for the type in question.
|
||||
pub fn init<T>() -> T;
|
||||
|
@ -988,7 +988,7 @@ extern "rust-intrinsic" {
|
|||
/// beginning at `dst` with the same size.
|
||||
///
|
||||
/// Like [`read`], `copy_nonoverlapping` creates a bitwise copy of `T`, regardless of
|
||||
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using *both* the values
|
||||
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using *both* the values
|
||||
/// in the region beginning at `*src` and the region beginning at `*dst` can
|
||||
/// [violate memory safety][read-ownership].
|
||||
///
|
||||
|
@ -1055,7 +1055,7 @@ extern "rust-intrinsic" {
|
|||
/// [`copy_nonoverlapping`] can be used instead.
|
||||
///
|
||||
/// `copy` is semantically equivalent to C's [`memmove`], but with the argument
|
||||
/// order swapped. Copying takes place as if the bytes were copied from `src`
|
||||
/// order swapped. Copying takes place as if the bytes were copied from `src`
|
||||
/// to a temporary array and then copied from the array to `dst`.
|
||||
///
|
||||
/// [`copy_nonoverlapping`]: ./fn.copy_nonoverlapping.html
|
||||
|
@ -1072,7 +1072,7 @@ extern "rust-intrinsic" {
|
|||
/// * Both `src` and `dst` must be properly aligned.
|
||||
///
|
||||
/// Like [`read`], `copy` creates a bitwise copy of `T`, regardless of
|
||||
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the values
|
||||
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the values
|
||||
/// in the region beginning at `*src` and the region beginning at `*dst` can
|
||||
/// [violate memory safety][read-ownership].
|
||||
///
|
||||
|
|
|
@ -564,9 +564,9 @@ pub trait Iterator {
|
|||
/// Calls a closure on each element of an iterator.
|
||||
///
|
||||
/// This is equivalent to using a [`for`] loop on the iterator, although
|
||||
/// `break` and `continue` are not possible from a closure. It's generally
|
||||
/// `break` and `continue` are not possible from a closure. It's generally
|
||||
/// more idiomatic to use a `for` loop, but `for_each` may be more legible
|
||||
/// when processing items at the end of longer iterator chains. In some
|
||||
/// when processing items at the end of longer iterator chains. In some
|
||||
/// cases `for_each` may also be faster than a loop, because it will use
|
||||
/// internal iteration on adaptors like `Chain`.
|
||||
///
|
||||
|
@ -1515,7 +1515,7 @@ pub trait Iterator {
|
|||
/// is propagated back to the caller immediately (short-circuiting).
|
||||
///
|
||||
/// The initial value is the value the accumulator will have on the first
|
||||
/// call. If applying the closure succeeded against every element of the
|
||||
/// call. If applying the closure succeeded against every element of the
|
||||
/// iterator, `try_fold()` returns the final accumulator as success.
|
||||
///
|
||||
/// Folding is useful whenever you have a collection of something, and want
|
||||
|
@ -1528,10 +1528,10 @@ pub trait Iterator {
|
|||
/// do something better than the default `for` loop implementation.
|
||||
///
|
||||
/// In particular, try to have this call `try_fold()` on the internal parts
|
||||
/// from which this iterator is composed. If multiple calls are needed,
|
||||
/// from which this iterator is composed. If multiple calls are needed,
|
||||
/// the `?` operator may be convenient for chaining the accumulator value
|
||||
/// along, but beware any invariants that need to be upheld before those
|
||||
/// early returns. This is a `&mut self` method, so iteration needs to be
|
||||
/// early returns. This is a `&mut self` method, so iteration needs to be
|
||||
/// resumable after hitting an error here.
|
||||
///
|
||||
/// # Examples
|
||||
|
|
|
@ -432,7 +432,7 @@ macro_rules! writeln {
|
|||
/// * Iterators that dynamically terminate.
|
||||
///
|
||||
/// If the determination that the code is unreachable proves incorrect, the
|
||||
/// program immediately terminates with a [`panic!`]. The function [`unreachable_unchecked`],
|
||||
/// program immediately terminates with a [`panic!`]. The function [`unreachable_unchecked`],
|
||||
/// which belongs to the [`std::hint`] module, informs the compiler to
|
||||
/// optimize the code out of the release version entirely.
|
||||
///
|
||||
|
|
|
@ -1101,7 +1101,7 @@ impl<T> MaybeUninit<T> {
|
|||
}
|
||||
|
||||
/// Create a new `MaybeUninit` in an uninitialized state, with the memory being
|
||||
/// filled with `0` bytes. It depends on `T` whether that already makes for
|
||||
/// filled with `0` bytes. It depends on `T` whether that already makes for
|
||||
/// proper initialization. For example, `MaybeUninit<usize>::zeroed()` is initialized,
|
||||
/// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not
|
||||
/// be null.
|
||||
|
@ -1130,7 +1130,7 @@ impl<T> MaybeUninit<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Extract the value from the `MaybeUninit` container. This is a great way
|
||||
/// Extract the value from the `MaybeUninit` container. This is a great way
|
||||
/// to ensure that the data will get dropped, because the resulting `T` is
|
||||
/// subject to the usual drop handling.
|
||||
///
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
//!
|
||||
//! In addition, there are numerous helper functions that are used in the paper but not available
|
||||
//! in Rust (or at least in core). Our version is additionally complicated by the need to handle
|
||||
//! overflow and underflow and the desire to handle subnormal numbers. Bellerophon and
|
||||
//! overflow and underflow and the desire to handle subnormal numbers. Bellerophon and
|
||||
//! Algorithm R have trouble with overflow, subnormals, and underflow. We conservatively switch to
|
||||
//! Algorithm M (with the modifications described in section 8 of the paper) well before the
|
||||
//! inputs get into the critical region.
|
||||
|
@ -148,7 +148,7 @@ macro_rules! from_str_float_impl {
|
|||
/// # Return value
|
||||
///
|
||||
/// `Err(ParseFloatError)` if the string did not represent a valid
|
||||
/// number. Otherwise, `Ok(n)` where `n` is the floating-point
|
||||
/// number. Otherwise, `Ok(n)` where `n` is the floating-point
|
||||
/// number represented by `src`.
|
||||
#[inline]
|
||||
fn from_str(src: &str) -> Result<Self, ParseFloatError> {
|
||||
|
@ -209,7 +209,7 @@ fn pfe_invalid() -> ParseFloatError {
|
|||
ParseFloatError { kind: FloatErrorKind::Invalid }
|
||||
}
|
||||
|
||||
/// Split decimal string into sign and the rest, without inspecting or validating the rest.
|
||||
/// Splits a decimal string into sign and the rest, without inspecting or validating the rest.
|
||||
fn extract_sign(s: &str) -> (Sign, &str) {
|
||||
match s.as_bytes()[0] {
|
||||
b'+' => (Sign::Positive, &s[1..]),
|
||||
|
|
|
@ -59,10 +59,10 @@ pub trait RawFloat
|
|||
/// Type used by `to_bits` and `from_bits`.
|
||||
type Bits: Add<Output = Self::Bits> + From<u8> + TryFrom<u64>;
|
||||
|
||||
/// Raw transmutation to integer.
|
||||
/// Performs a raw transmutation to an integer.
|
||||
fn to_bits(self) -> Self::Bits;
|
||||
|
||||
/// Raw transmutation from integer.
|
||||
/// Performs a raw transmutation from an integer.
|
||||
fn from_bits(v: Self::Bits) -> Self;
|
||||
|
||||
/// Returns the category that this number falls into.
|
||||
|
@ -71,14 +71,14 @@ pub trait RawFloat
|
|||
/// Returns the mantissa, exponent and sign as integers.
|
||||
fn integer_decode(self) -> (u64, i16, i8);
|
||||
|
||||
/// Decode the float.
|
||||
/// Decodes the float.
|
||||
fn unpack(self) -> Unpacked;
|
||||
|
||||
/// Cast from a small integer that can be represented exactly. Panic if the integer can't be
|
||||
/// Casts from a small integer that can be represented exactly. Panic if the integer can't be
|
||||
/// represented, the other code in this module makes sure to never let that happen.
|
||||
fn from_int(x: u64) -> Self;
|
||||
|
||||
/// Get the value 10<sup>e</sup> from a pre-computed table.
|
||||
/// Gets the value 10<sup>e</sup> from a pre-computed table.
|
||||
/// Panics for `e >= CEIL_LOG5_OF_MAX_SIG`.
|
||||
fn short_fast_pow10(e: usize) -> Self;
|
||||
|
||||
|
|
|
@ -518,7 +518,7 @@ pub trait Rem<RHS=Self> {
|
|||
|
||||
macro_rules! rem_impl_integer {
|
||||
($($t:ty)*) => ($(
|
||||
/// This operation satisfies `n % d == n - (n / d) * d`. The
|
||||
/// This operation satisfies `n % d == n - (n / d) * d`. The
|
||||
/// result has the same sign as the left operand.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Rem for $t {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// A trait for customizing the behavior of the `?` operator.
|
||||
///
|
||||
/// A type implementing `Try` is one that has a canonical way to view it
|
||||
/// in terms of a success/failure dichotomy. This trait allows both
|
||||
/// in terms of a success/failure dichotomy. This trait allows both
|
||||
/// extracting those success or failure values from an existing instance and
|
||||
/// creating a new instance from a success or failure value.
|
||||
#[unstable(feature = "try_trait", issue = "42327")]
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
//! to access only a single value, in which case the documentation omits the size
|
||||
//! and implicitly assumes it to be `size_of::<T>()` bytes.
|
||||
//!
|
||||
//! The precise rules for validity are not determined yet. The guarantees that are
|
||||
//! The precise rules for validity are not determined yet. The guarantees that are
|
||||
//! provided at this point are very minimal:
|
||||
//!
|
||||
//! * A [null] pointer is *never* valid, not even for accesses of [size zero][zst].
|
||||
|
@ -104,7 +104,7 @@ pub use intrinsics::write_bytes;
|
|||
///
|
||||
/// * `to_drop` must be [valid] for reads.
|
||||
///
|
||||
/// * `to_drop` must be properly aligned. See the example below for how to drop
|
||||
/// * `to_drop` must be properly aligned. See the example below for how to drop
|
||||
/// an unaligned pointer.
|
||||
///
|
||||
/// Additionally, if `T` is not [`Copy`], using the pointed-to value after
|
||||
|
@ -135,7 +135,7 @@ pub use intrinsics::write_bytes;
|
|||
/// unsafe {
|
||||
/// // Get a raw pointer to the last element in `v`.
|
||||
/// let ptr = &mut v[1] as *mut _;
|
||||
/// // Shorten `v` to prevent the last item from being dropped. We do that first,
|
||||
/// // Shorten `v` to prevent the last item from being dropped. We do that first,
|
||||
/// // to prevent issues if the `drop_in_place` below panics.
|
||||
/// v.set_len(1);
|
||||
/// // Without a call `drop_in_place`, the last item would never be dropped,
|
||||
|
@ -531,7 +531,7 @@ pub unsafe fn replace<T>(dst: *mut T, mut src: T) -> T {
|
|||
///
|
||||
/// `read` creates a bitwise copy of `T`, regardless of whether `T` is [`Copy`].
|
||||
/// If `T` is not [`Copy`], using both the returned value and the value at
|
||||
/// `*src` can violate memory safety. Note that assigning to `*src` counts as a
|
||||
/// `*src` can violate memory safety. Note that assigning to `*src` counts as a
|
||||
/// use because it will attempt to drop the value at `*src`.
|
||||
///
|
||||
/// [`write`] can be used to overwrite data without causing it to be dropped.
|
||||
|
@ -588,7 +588,7 @@ pub unsafe fn read<T>(src: *const T) -> T {
|
|||
/// * `src` must be [valid] for reads.
|
||||
///
|
||||
/// Like [`read`], `read_unaligned` creates a bitwise copy of `T`, regardless of
|
||||
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned
|
||||
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned
|
||||
/// value and the value at `*src` can [violate memory safety][read-ownership].
|
||||
///
|
||||
/// Note that even if `T` has size `0`, the pointer must be non-NULL.
|
||||
|
@ -839,7 +839,7 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
|
|||
/// * `src` must be properly aligned.
|
||||
///
|
||||
/// Like [`read`], `read_unaligned` creates a bitwise copy of `T`, regardless of
|
||||
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned
|
||||
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned
|
||||
/// value and the value at `*src` can [violate memory safety][read-ownership].
|
||||
/// However, storing non-[`Copy`] types in volatile memory is almost certainly
|
||||
/// incorrect.
|
||||
|
@ -1093,7 +1093,7 @@ impl<T: ?Sized> *const T {
|
|||
/// unless `x` and `y` point into the same allocated object.
|
||||
///
|
||||
/// Always use `.offset(count)` instead when possible, because `offset`
|
||||
/// allows the compiler to optimize better. If you need to cross object
|
||||
/// allows the compiler to optimize better. If you need to cross object
|
||||
/// boundaries, cast the pointer to an integer and do the arithmetic there.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -1712,7 +1712,7 @@ impl<T: ?Sized> *mut T {
|
|||
/// unless `x` and `y` point into the same allocated object.
|
||||
///
|
||||
/// Always use `.offset(count)` instead when possible, because `offset`
|
||||
/// allows the compiler to optimize better. If you need to cross object
|
||||
/// allows the compiler to optimize better. If you need to cross object
|
||||
/// boundaries, cast the pointer to an integer and do the arithmetic there.
|
||||
///
|
||||
/// # Examples
|
||||
|
|
|
@ -1197,7 +1197,7 @@ impl<T> [T] {
|
|||
|
||||
/// Returns an iterator over subslices separated by elements that match
|
||||
/// `pred` limited to returning at most `n` items. This starts at the end of
|
||||
/// the slice and works backwards. The matched element is not contained in
|
||||
/// the slice and works backwards. The matched element is not contained in
|
||||
/// the subslices.
|
||||
///
|
||||
/// The last element returned, if any, will contain the remainder of the
|
||||
|
@ -3145,7 +3145,7 @@ unsafe impl<T: Sync> Sync for Iter<'_, T> {}
|
|||
unsafe impl<T: Sync> Send for Iter<'_, T> {}
|
||||
|
||||
impl<'a, T> Iter<'a, T> {
|
||||
/// View the underlying data as a subslice of the original data.
|
||||
/// Views the underlying data as a subslice of the original data.
|
||||
///
|
||||
/// This has the same lifetime as the original slice, and so the
|
||||
/// iterator can continue to be used while this exists.
|
||||
|
@ -3247,7 +3247,7 @@ unsafe impl<T: Sync> Sync for IterMut<'_, T> {}
|
|||
unsafe impl<T: Send> Send for IterMut<'_, T> {}
|
||||
|
||||
impl<'a, T> IterMut<'a, T> {
|
||||
/// View the underlying data as a subslice of the original data.
|
||||
/// Views the underlying data as a subslice of the original data.
|
||||
///
|
||||
/// To avoid creating `&mut` references that alias, this is forced
|
||||
/// to consume the iterator.
|
||||
|
|
|
@ -26,7 +26,7 @@ impl<T> RawArray<T> {
|
|||
}
|
||||
|
||||
/// Rotates the range `[mid-left, mid+right)` such that the element at `mid`
|
||||
/// becomes the first element. Equivalently, rotates the range `left`
|
||||
/// becomes the first element. Equivalently, rotates the range `left`
|
||||
/// elements to the left or `right` elements to the right.
|
||||
///
|
||||
/// # Safety
|
||||
|
@ -36,10 +36,10 @@ impl<T> RawArray<T> {
|
|||
/// # Algorithm
|
||||
///
|
||||
/// For longer rotations, swap the left-most `delta = min(left, right)`
|
||||
/// elements with the right-most `delta` elements. LLVM vectorizes this,
|
||||
/// elements with the right-most `delta` elements. LLVM vectorizes this,
|
||||
/// which is profitable as we only reach this step for a "large enough"
|
||||
/// rotation. Doing this puts `delta` elements on the larger side into the
|
||||
/// correct position, leaving a smaller rotate problem. Demonstration:
|
||||
/// rotation. Doing this puts `delta` elements on the larger side into the
|
||||
/// correct position, leaving a smaller rotate problem. Demonstration:
|
||||
///
|
||||
/// ```text
|
||||
/// [ 6 7 8 9 10 11 12 13 . 1 2 3 4 5 ]
|
||||
|
|
|
@ -612,7 +612,7 @@ impl<'a> DoubleEndedIterator for Chars<'a> {
|
|||
impl FusedIterator for Chars<'_> {}
|
||||
|
||||
impl<'a> Chars<'a> {
|
||||
/// View the underlying data as a subslice of the original data.
|
||||
/// Views the underlying data as a subslice of the original data.
|
||||
///
|
||||
/// This has the same lifetime as the original slice, and so the
|
||||
/// iterator can continue to be used while this exists.
|
||||
|
@ -702,7 +702,7 @@ impl<'a> DoubleEndedIterator for CharIndices<'a> {
|
|||
impl FusedIterator for CharIndices<'_> {}
|
||||
|
||||
impl<'a> CharIndices<'a> {
|
||||
/// View the underlying data as a subslice of the original data.
|
||||
/// Views the underlying data as a subslice of the original data.
|
||||
///
|
||||
/// This has the same lifetime as the original slice, and so the
|
||||
/// iterator can continue to be used while this exists.
|
||||
|
@ -1579,9 +1579,9 @@ mod traits {
|
|||
|
||||
/// Implements ordering of strings.
|
||||
///
|
||||
/// Strings are ordered lexicographically by their byte values. This orders Unicode code
|
||||
/// points based on their positions in the code charts. This is not necessarily the same as
|
||||
/// "alphabetical" order, which varies by language and locale. Sorting strings according to
|
||||
/// Strings are ordered lexicographically by their byte values. This orders Unicode code
|
||||
/// points based on their positions in the code charts. This is not necessarily the same as
|
||||
/// "alphabetical" order, which varies by language and locale. Sorting strings according to
|
||||
/// culturally-accepted standards requires locale-specific data that is outside the scope of
|
||||
/// the `str` type.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
@ -1607,9 +1607,9 @@ mod traits {
|
|||
|
||||
/// Implements comparison operations on strings.
|
||||
///
|
||||
/// Strings are compared lexicographically by their byte values. This compares Unicode code
|
||||
/// points based on their positions in the code charts. This is not necessarily the same as
|
||||
/// "alphabetical" order, which varies by language and locale. Comparing strings according to
|
||||
/// Strings are compared lexicographically by their byte values. This compares Unicode code
|
||||
/// points based on their positions in the code charts. This is not necessarily the same as
|
||||
/// "alphabetical" order, which varies by language and locale. Comparing strings according to
|
||||
/// culturally-accepted standards requires locale-specific data that is outside the scope of
|
||||
/// the `str` type.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
@ -2643,7 +2643,7 @@ impl str {
|
|||
Bytes(self.as_bytes().iter().cloned())
|
||||
}
|
||||
|
||||
/// Split a string slice by whitespace.
|
||||
/// Splits a string slice by whitespace.
|
||||
///
|
||||
/// The iterator returned will return string slices that are sub-slices of
|
||||
/// the original string slice, separated by any amount of whitespace.
|
||||
|
@ -2686,7 +2686,7 @@ impl str {
|
|||
SplitWhitespace { inner: self.split(IsWhitespace).filter(IsNotEmpty) }
|
||||
}
|
||||
|
||||
/// Split a string slice by ASCII whitespace.
|
||||
/// Splits a string slice by ASCII whitespace.
|
||||
///
|
||||
/// The iterator returned will return string slices that are sub-slices of
|
||||
/// the original string slice, separated by any amount of ASCII whitespace.
|
||||
|
|
|
@ -43,7 +43,7 @@ pub const NANOSECOND: Duration = Duration::from_nanos(1);
|
|||
/// timeouts.
|
||||
///
|
||||
/// Each `Duration` is composed of a whole number of seconds and a fractional part
|
||||
/// represented in nanoseconds. If the underlying system does not support
|
||||
/// represented in nanoseconds. If the underlying system does not support
|
||||
/// nanosecond-level precision, APIs binding a system timeout will typically round up
|
||||
/// the number of nanoseconds.
|
||||
///
|
||||
|
|
|
@ -38,7 +38,7 @@ impl<T: LambdaL> ScopedCell<T> {
|
|||
ScopedCell(Cell::new(value))
|
||||
}
|
||||
|
||||
/// Set the value in `self` to `replacement` while
|
||||
/// Sets the value in `self` to `replacement` while
|
||||
/// running `f`, which gets the old value, mutably.
|
||||
/// The old value will be restored after `f` exits, even
|
||||
/// by panic, including modifications made to it by `f`.
|
||||
|
@ -73,7 +73,7 @@ impl<T: LambdaL> ScopedCell<T> {
|
|||
f(RefMutL(put_back_on_drop.value.as_mut().unwrap()))
|
||||
}
|
||||
|
||||
/// Set the value in `self` to `value` while running `f`.
|
||||
/// Sets the value in `self` to `value` while running `f`.
|
||||
pub fn set<'a, R>(&self, value: <T as ApplyL<'a>>::Out, f: impl FnOnce() -> R) -> R {
|
||||
self.replace(value, |_| f())
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ pub struct Diagnostic {
|
|||
|
||||
macro_rules! diagnostic_child_methods {
|
||||
($spanned:ident, $regular:ident, $level:expr) => (
|
||||
/// Add a new child diagnostic message to `self` with the level
|
||||
/// Adds a new child diagnostic message to `self` with the level
|
||||
/// identified by this method's name with the given `spans` and
|
||||
/// `message`.
|
||||
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
|
||||
|
@ -67,7 +67,7 @@ macro_rules! diagnostic_child_methods {
|
|||
self
|
||||
}
|
||||
|
||||
/// Add a new child diagnostic message to `self` with the level
|
||||
/// Adds a new child diagnostic message to `self` with the level
|
||||
/// identified by this method's name with the given `message`.
|
||||
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
|
||||
pub fn $regular<T: Into<String>>(mut self, message: T) -> Diagnostic {
|
||||
|
@ -93,7 +93,7 @@ impl<'a> Iterator for Children<'a> {
|
|||
|
||||
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
|
||||
impl Diagnostic {
|
||||
/// Create a new diagnostic with the given `level` and `message`.
|
||||
/// Creates a new diagnostic with the given `level` and `message`.
|
||||
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
|
||||
pub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic {
|
||||
Diagnostic {
|
||||
|
@ -104,7 +104,7 @@ impl Diagnostic {
|
|||
}
|
||||
}
|
||||
|
||||
/// Create a new diagnostic with the given `level` and `message` pointing to
|
||||
/// Creates a new diagnostic with the given `level` and `message` pointing to
|
||||
/// the given set of `spans`.
|
||||
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
|
||||
pub fn spanned<S, T>(spans: S, level: Level, message: T) -> Diagnostic
|
||||
|
|
|
@ -88,7 +88,7 @@ impl TokenStream {
|
|||
/// or characters not existing in the language.
|
||||
/// All tokens in the parsed stream get `Span::call_site()` spans.
|
||||
///
|
||||
/// NOTE: Some errors may cause panics instead of returning `LexError`. We reserve the right to
|
||||
/// NOTE: some errors may cause panics instead of returning `LexError`. We reserve the right to
|
||||
/// change these errors into `LexError`s later.
|
||||
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
|
||||
impl FromStr for TokenStream {
|
||||
|
@ -244,7 +244,7 @@ impl !Sync for Span {}
|
|||
|
||||
macro_rules! diagnostic_method {
|
||||
($name:ident, $level:expr) => (
|
||||
/// Create a new `Diagnostic` with the given `message` at the span
|
||||
/// Creates a new `Diagnostic` with the given `message` at the span
|
||||
/// `self`.
|
||||
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
|
||||
pub fn $name<T: Into<String>>(self, message: T) -> Diagnostic {
|
||||
|
@ -290,19 +290,19 @@ impl Span {
|
|||
Span(self.0.source())
|
||||
}
|
||||
|
||||
/// Get the starting line/column in the source file for this span.
|
||||
/// Gets the starting line/column in the source file for this span.
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
pub fn start(&self) -> LineColumn {
|
||||
self.0.start()
|
||||
}
|
||||
|
||||
/// Get the ending line/column in the source file for this span.
|
||||
/// Gets the ending line/column in the source file for this span.
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
pub fn end(&self) -> LineColumn {
|
||||
self.0.end()
|
||||
}
|
||||
|
||||
/// Create a new span encompassing `self` and `other`.
|
||||
/// Creates a new span encompassing `self` and `other`.
|
||||
///
|
||||
/// Returns `None` if `self` and `other` are from different files.
|
||||
#[unstable(feature = "proc_macro_span", issue = "54725")]
|
||||
|
@ -368,7 +368,7 @@ impl !Sync for LineColumn {}
|
|||
pub struct SourceFile(bridge::client::SourceFile);
|
||||
|
||||
impl SourceFile {
|
||||
/// Get the path to this source file.
|
||||
/// Gets the path to this source file.
|
||||
///
|
||||
/// ### Note
|
||||
/// If the code span associated with this `SourceFile` was generated by an external macro, this
|
||||
|
|
|
@ -250,7 +250,7 @@ impl f64 {
|
|||
/// Calculates the least nonnegative remainder of `self (mod rhs)`.
|
||||
///
|
||||
/// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in
|
||||
/// most cases. However, due to a floating point round-off error it can
|
||||
/// most cases. However, due to a floating point round-off error it can
|
||||
/// result in `r == rhs.abs()`, violating the mathematical definition, if
|
||||
/// `self` is much smaller than `rhs.abs()` in magnitude and `self < 0.0`.
|
||||
/// This result is not an element of the function's codomain, but it is the
|
||||
|
|
|
@ -24,7 +24,7 @@ use sys_common::{AsInner, IntoInner, FromInner};
|
|||
///
|
||||
/// `OsString` and [`OsStr`] bridge this gap by simultaneously representing Rust
|
||||
/// and platform-native string values, and in particular allowing a Rust string
|
||||
/// to be converted into an "OS" string with no cost if possible. A consequence
|
||||
/// to be converted into an "OS" string with no cost if possible. A consequence
|
||||
/// of this is that `OsString` instances are *not* `NUL` terminated; in order
|
||||
/// to pass to e.g., Unix system call, you should create a [`CStr`].
|
||||
///
|
||||
|
|
|
@ -222,7 +222,7 @@ fn initial_buffer_size(file: &File) -> usize {
|
|||
/// Read the entire contents of a file into a bytes vector.
|
||||
///
|
||||
/// This is a convenience function for using [`File::open`] and [`read_to_end`]
|
||||
/// with fewer imports and without an intermediate variable. It pre-allocates a
|
||||
/// with fewer imports and without an intermediate variable. It pre-allocates a
|
||||
/// buffer based on the file size when available, so it is generally faster than
|
||||
/// reading into a vector created with `Vec::new()`.
|
||||
///
|
||||
|
@ -263,7 +263,7 @@ pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
|
|||
/// Read the entire contents of a file into a string.
|
||||
///
|
||||
/// This is a convenience function for using [`File::open`] and [`read_to_string`]
|
||||
/// with fewer imports and without an intermediate variable. It pre-allocates a
|
||||
/// with fewer imports and without an intermediate variable. It pre-allocates a
|
||||
/// buffer based on the file size when available, so it is generally faster than
|
||||
/// reading into a string created with `String::new()`.
|
||||
///
|
||||
|
|
|
@ -16,9 +16,9 @@ use memchr;
|
|||
/// the underlying [`Read`] and maintains an in-memory buffer of the results.
|
||||
///
|
||||
/// `BufReader` can improve the speed of programs that make *small* and
|
||||
/// *repeated* read calls to the same file or network socket. It does not
|
||||
/// *repeated* read calls to the same file or network socket. It does not
|
||||
/// help when reading very large amounts at once, or reading just one or a few
|
||||
/// times. It also provides no advantage when reading from a source that is
|
||||
/// times. It also provides no advantage when reading from a source that is
|
||||
/// already in memory, like a `Vec<u8>`.
|
||||
///
|
||||
/// [`Read`]: ../../std/io/trait.Read.html
|
||||
|
@ -331,9 +331,9 @@ impl<R: Seek> Seek for BufReader<R> {
|
|||
/// writer in large, infrequent batches.
|
||||
///
|
||||
/// `BufWriter` can improve the speed of programs that make *small* and
|
||||
/// *repeated* write calls to the same file or network socket. It does not
|
||||
/// *repeated* write calls to the same file or network socket. It does not
|
||||
/// help when writing very large amounts at once, or writing just one or a few
|
||||
/// times. It also provides no advantage when writing to a destination that is
|
||||
/// times. It also provides no advantage when writing to a destination that is
|
||||
/// in memory, like a `Vec<u8>`.
|
||||
///
|
||||
/// When the `BufWriter` is dropped, the contents of its buffer will be written
|
||||
|
|
|
@ -627,7 +627,7 @@ mod loop_keyword { }
|
|||
/// directly accessed and modified.
|
||||
///
|
||||
/// Tuple structs are similar to regular structs, but its fields have no names. They are used like
|
||||
/// tuples, with deconstruction possible via `let TupleStruct(x, y) = foo;` syntax. For accessing
|
||||
/// tuples, with deconstruction possible via `let TupleStruct(x, y) = foo;` syntax. For accessing
|
||||
/// individual variables, the same syntax is used as with regular tuples, namely `foo.0`, `foo.1`,
|
||||
/// etc, starting at zero.
|
||||
///
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
/// an unrecoverable problem.
|
||||
///
|
||||
/// This macro is the perfect way to assert conditions in example code and in
|
||||
/// tests. `panic!` is closely tied with the `unwrap` method of both [`Option`]
|
||||
/// and [`Result`][runwrap] enums. Both implementations call `panic!` when they are set
|
||||
/// tests. `panic!` is closely tied with the `unwrap` method of both [`Option`]
|
||||
/// and [`Result`][runwrap] enums. Both implementations call `panic!` when they are set
|
||||
/// to None or Err variants.
|
||||
///
|
||||
/// This macro is used to inject panic into a Rust thread, causing the thread to
|
||||
|
@ -21,7 +21,7 @@
|
|||
/// is transmitted.
|
||||
///
|
||||
/// [`Result`] enum is often a better solution for recovering from errors than
|
||||
/// using the `panic!` macro. This macro should be used to avoid proceeding using
|
||||
/// using the `panic!` macro. This macro should be used to avoid proceeding using
|
||||
/// incorrect values, such as from external sources. Detailed information about
|
||||
/// error handling is found in the [book].
|
||||
///
|
||||
|
@ -79,7 +79,7 @@ macro_rules! panic {
|
|||
/// necessary to use [`io::stdout().flush()`][flush] to ensure the output is emitted
|
||||
/// immediately.
|
||||
///
|
||||
/// Use `print!` only for the primary output of your program. Use
|
||||
/// Use `print!` only for the primary output of your program. Use
|
||||
/// [`eprint!`] instead to print error and progress messages.
|
||||
///
|
||||
/// [`println!`]: ../std/macro.println.html
|
||||
|
@ -124,7 +124,7 @@ macro_rules! print {
|
|||
/// Use the [`format!`] syntax to write data to the standard output.
|
||||
/// See [`std::fmt`] for more information.
|
||||
///
|
||||
/// Use `println!` only for the primary output of your program. Use
|
||||
/// Use `println!` only for the primary output of your program. Use
|
||||
/// [`eprintln!`] instead to print error and progress messages.
|
||||
///
|
||||
/// [`format!`]: ../std/macro.format.html
|
||||
|
@ -154,10 +154,10 @@ macro_rules! println {
|
|||
/// Macro for printing to the standard error.
|
||||
///
|
||||
/// Equivalent to the [`print!`] macro, except that output goes to
|
||||
/// [`io::stderr`] instead of `io::stdout`. See [`print!`] for
|
||||
/// [`io::stderr`] instead of `io::stdout`. See [`print!`] for
|
||||
/// example usage.
|
||||
///
|
||||
/// Use `eprint!` only for error and progress messages. Use `print!`
|
||||
/// Use `eprint!` only for error and progress messages. Use `print!`
|
||||
/// instead for the primary output of your program.
|
||||
///
|
||||
/// [`io::stderr`]: ../std/io/struct.Stderr.html
|
||||
|
@ -182,10 +182,10 @@ macro_rules! eprint {
|
|||
/// Macro for printing to the standard error, with a newline.
|
||||
///
|
||||
/// Equivalent to the [`println!`] macro, except that output goes to
|
||||
/// [`io::stderr`] instead of `io::stdout`. See [`println!`] for
|
||||
/// [`io::stderr`] instead of `io::stdout`. See [`println!`] for
|
||||
/// example usage.
|
||||
///
|
||||
/// Use `eprintln!` only for error and progress messages. Use `println!`
|
||||
/// Use `eprintln!` only for error and progress messages. Use `println!`
|
||||
/// instead for the primary output of your program.
|
||||
///
|
||||
/// [`io::stderr`]: ../std/io/struct.Stderr.html
|
||||
|
@ -462,16 +462,16 @@ mod builtin {
|
|||
/// The core macro for formatted string creation & output.
|
||||
///
|
||||
/// This macro functions by taking a formatting string literal containing
|
||||
/// `{}` for each additional argument passed. `format_args!` prepares the
|
||||
/// `{}` for each additional argument passed. `format_args!` prepares the
|
||||
/// additional parameters to ensure the output can be interpreted as a string
|
||||
/// and canonicalizes the arguments into a single type. Any value that implements
|
||||
/// and canonicalizes the arguments into a single type. Any value that implements
|
||||
/// the [`Display`] trait can be passed to `format_args!`, as can any
|
||||
/// [`Debug`] implementation be passed to a `{:?}` within the formatting string.
|
||||
///
|
||||
/// This macro produces a value of type [`fmt::Arguments`]. This value can be
|
||||
/// passed to the macros within [`std::fmt`] for performing useful redirection.
|
||||
/// All other formatting macros ([`format!`], [`write!`], [`println!`], etc) are
|
||||
/// proxied through this one. `format_args!`, unlike its derived macros, avoids
|
||||
/// proxied through this one. `format_args!`, unlike its derived macros, avoids
|
||||
/// heap allocations.
|
||||
///
|
||||
/// You can use the [`fmt::Arguments`] value that `format_args!` returns
|
||||
|
@ -554,7 +554,7 @@ mod builtin {
|
|||
/// If the named environment variable is present at compile time, this will
|
||||
/// expand into an expression of type `Option<&'static str>` whose value is
|
||||
/// `Some` of the value of the environment variable. If the environment
|
||||
/// variable is not present, then this will expand to `None`. See
|
||||
/// variable is not present, then this will expand to `None`. See
|
||||
/// [`Option<T>`][option] for more information on this type.
|
||||
///
|
||||
/// A compile time error is never emitted when using this macro regardless
|
||||
|
@ -904,7 +904,7 @@ mod builtin {
|
|||
/// # Custom Messages
|
||||
///
|
||||
/// This macro has a second form, where a custom panic message can
|
||||
/// be provided with or without arguments for formatting. See [`std::fmt`]
|
||||
/// be provided with or without arguments for formatting. See [`std::fmt`]
|
||||
/// for syntax for this form.
|
||||
///
|
||||
/// [`panic!`]: macro.panic.html
|
||||
|
|
|
@ -671,7 +671,7 @@ impl hash::Hash for SocketAddrV6 {
|
|||
/// [`SocketAddr`] values.
|
||||
///
|
||||
/// This trait is used for generic address resolution when constructing network
|
||||
/// objects. By default it is implemented for the following types:
|
||||
/// objects. By default it is implemented for the following types:
|
||||
///
|
||||
/// * [`SocketAddr`]: [`to_socket_addrs`] is the identity function.
|
||||
///
|
||||
|
|
|
@ -1062,7 +1062,7 @@ mod prim_ref { }
|
|||
/// On top of that, function pointers can vary based on what ABI they use. This is achieved by
|
||||
/// adding the `extern` keyword to the type name, followed by the ABI in question. For example,
|
||||
/// `fn()` is different from `extern "C" fn()`, which itself is different from `extern "stdcall"
|
||||
/// fn()`, and so on for the various ABIs that Rust supports. Non-`extern` functions have an ABI
|
||||
/// fn()`, and so on for the various ABIs that Rust supports. Non-`extern` functions have an ABI
|
||||
/// of `"Rust"`, and `extern` functions without an explicit ABI have an ABI of `"C"`. For more
|
||||
/// information, see [the nomicon's section on foreign calling conventions][nomicon-abi].
|
||||
///
|
||||
|
|
|
@ -343,13 +343,13 @@ impl Condvar {
|
|||
///
|
||||
/// Note that the best effort is made to ensure that the time waited is
|
||||
/// measured with a monotonic clock, and not affected by the changes made to
|
||||
/// the system time. This function is susceptible to spurious wakeups.
|
||||
/// the system time. This function is susceptible to spurious wakeups.
|
||||
/// Condition variables normally have a boolean predicate associated with
|
||||
/// them, and the predicate must always be checked each time this function
|
||||
/// returns to protect against spurious wakeups. Additionally, it is
|
||||
/// returns to protect against spurious wakeups. Additionally, it is
|
||||
/// typically desirable for the time-out to not exceed some duration in
|
||||
/// spite of spurious wakes, thus the sleep-duration is decremented by the
|
||||
/// amount slept. Alternatively, use the `wait_timeout_until` method
|
||||
/// amount slept. Alternatively, use the `wait_timeout_until` method
|
||||
/// to wait until a condition is met with a total time-out regardless
|
||||
/// of spurious wakes.
|
||||
///
|
||||
|
@ -413,7 +413,7 @@ impl Condvar {
|
|||
}
|
||||
|
||||
/// Waits on this condition variable for a notification, timing out after a
|
||||
/// specified duration. Spurious wakes will not cause this function to
|
||||
/// specified duration. Spurious wakes will not cause this function to
|
||||
/// return.
|
||||
///
|
||||
/// The semantics of this function are equivalent to [`wait_until`] except
|
||||
|
|
|
@ -789,7 +789,7 @@ impl<T> Sender<T> {
|
|||
/// where the corresponding receiver has already been deallocated. Note
|
||||
/// that a return value of [`Err`] means that the data will never be
|
||||
/// received, but a return value of [`Ok`] does *not* mean that the data
|
||||
/// will be received. It is possible for the corresponding receiver to
|
||||
/// will be received. It is possible for the corresponding receiver to
|
||||
/// hang up immediately after this function returns [`Ok`].
|
||||
///
|
||||
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
|
||||
|
|
|
@ -72,11 +72,11 @@ struct SelectInner {
|
|||
impl !marker::Send for Select {}
|
||||
|
||||
/// A handle to a receiver which is currently a member of a `Select` set of
|
||||
/// receivers. This handle is used to keep the receiver in the set as well as
|
||||
/// receivers. This handle is used to keep the receiver in the set as well as
|
||||
/// interact with the underlying receiver.
|
||||
pub struct Handle<'rx, T:Send+'rx> {
|
||||
/// The ID of this handle, used to compare against the return value of
|
||||
/// `Select::wait()`
|
||||
/// `Select::wait()`.
|
||||
id: usize,
|
||||
selector: *mut SelectInner,
|
||||
next: *mut Handle<'static, ()>,
|
||||
|
|
|
@ -314,7 +314,7 @@ impl<T: ?Sized> RwLock<T> {
|
|||
/// Determines whether the lock is poisoned.
|
||||
///
|
||||
/// If another thread is active, the lock can still become poisoned at any
|
||||
/// time. You should not trust a `false` value for program correctness
|
||||
/// time. You should not trust a `false` value for program correctness
|
||||
/// without additional synchronization.
|
||||
///
|
||||
/// # Examples
|
||||
|
|
|
@ -287,9 +287,9 @@ impl FileTypeExt for fs::FileType {
|
|||
/// # Note
|
||||
///
|
||||
/// On Windows, you must specify whether a symbolic link points to a file
|
||||
/// or directory. Use `os::windows::fs::symlink_file` to create a
|
||||
/// or directory. Use `os::windows::fs::symlink_file` to create a
|
||||
/// symbolic link to a file, or `os::windows::fs::symlink_dir` to create a
|
||||
/// symbolic link to a directory. Additionally, the process must have
|
||||
/// symbolic link to a directory. Additionally, the process must have
|
||||
/// `SeCreateSymbolicLinkPrivilege` in order to be able to create a
|
||||
/// symbolic link.
|
||||
///
|
||||
|
|
|
@ -805,9 +805,9 @@ impl DirEntryExt for fs::DirEntry {
|
|||
/// # Note
|
||||
///
|
||||
/// On Windows, you must specify whether a symbolic link points to a file
|
||||
/// or directory. Use `os::windows::fs::symlink_file` to create a
|
||||
/// or directory. Use `os::windows::fs::symlink_file` to create a
|
||||
/// symbolic link to a file, or `os::windows::fs::symlink_dir` to create a
|
||||
/// symbolic link to a directory. Additionally, the process must have
|
||||
/// symbolic link to a directory. Additionally, the process must have
|
||||
/// `SeCreateSymbolicLinkPrivilege` in order to be able to create a
|
||||
/// symbolic link.
|
||||
///
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
//! # Overview
|
||||
//!
|
||||
//! For historical reasons, the Windows API uses a form of potentially
|
||||
//! ill-formed UTF-16 encoding for strings. Specifically, the 16-bit
|
||||
//! ill-formed UTF-16 encoding for strings. Specifically, the 16-bit
|
||||
//! code units in Windows strings may contain [isolated surrogate code
|
||||
//! points which are not paired together][ill-formed-utf-16]. The
|
||||
//! points which are not paired together][ill-formed-utf-16]. The
|
||||
//! Unicode standard requires that surrogate code points (those in the
|
||||
//! range U+D800 to U+DFFF) always be *paired*, because in the UTF-16
|
||||
//! encoding a *surrogate code unit pair* is used to encode a single
|
||||
//! character. For compatibility with code that does not enforce
|
||||
//! character. For compatibility with code that does not enforce
|
||||
//! these pairings, Windows does not enforce them, either.
|
||||
//!
|
||||
//! While it is not always possible to convert such a string losslessly into
|
||||
//! a valid UTF-16 string (or even UTF-8), it is often desirable to be
|
||||
//! able to round-trip such a string from and to Windows APIs
|
||||
//! losslessly. For example, some Rust code may be "bridging" some
|
||||
//! losslessly. For example, some Rust code may be "bridging" some
|
||||
//! Windows APIs together, just passing `WCHAR` strings among those
|
||||
//! APIs without ever really looking into the strings.
|
||||
//!
|
||||
|
@ -28,16 +28,16 @@
|
|||
//! # `OsStringExt` and `OsStrExt`
|
||||
//!
|
||||
//! [`OsString`] is the Rust wrapper for owned strings in the
|
||||
//! preferred representation of the operating system. On Windows,
|
||||
//! preferred representation of the operating system. On Windows,
|
||||
//! this struct gets augmented with an implementation of the
|
||||
//! [`OsStringExt`] trait, which has a [`from_wide`] method. This
|
||||
//! [`OsStringExt`] trait, which has a [`from_wide`] method. This
|
||||
//! lets you create an [`OsString`] from a `&[u16]` slice; presumably
|
||||
//! you get such a slice out of a `WCHAR` Windows API.
|
||||
//!
|
||||
//! Similarly, [`OsStr`] is the Rust wrapper for borrowed strings from
|
||||
//! preferred representation of the operating system. On Windows, the
|
||||
//! preferred representation of the operating system. On Windows, the
|
||||
//! [`OsStrExt`] trait provides the [`encode_wide`] method, which
|
||||
//! outputs an [`EncodeWide`] iterator. You can [`collect`] this
|
||||
//! outputs an [`EncodeWide`] iterator. You can [`collect`] this
|
||||
//! iterator, for example, to obtain a `Vec<u16>`; you can later get a
|
||||
//! pointer to this vector's contents and feed it to Windows APIs.
|
||||
//!
|
||||
|
|
|
@ -841,7 +841,7 @@ const NOTIFIED: usize = 2;
|
|||
/// let flag2 = Arc::clone(&flag);
|
||||
///
|
||||
/// let parked_thread = thread::spawn(move || {
|
||||
/// // We want to wait until the flag is set. We *could* just spin, but using
|
||||
/// // We want to wait until the flag is set. We *could* just spin, but using
|
||||
/// // park/unpark is more efficient.
|
||||
/// while !flag2.load(Ordering::Acquire) {
|
||||
/// println!("Parking thread");
|
||||
|
|
|
@ -33,7 +33,7 @@ pub use core::time::{SECOND, MILLISECOND, MICROSECOND, NANOSECOND};
|
|||
/// instant when created, and are often useful for tasks such as measuring
|
||||
/// benchmarks or timing how long an operation takes.
|
||||
///
|
||||
/// Note, however, that instants are not guaranteed to be **steady**. In other
|
||||
/// Note, however, that instants are not guaranteed to be **steady**. In other
|
||||
/// words, each tick of the underlying clock may not be the same length (e.g.
|
||||
/// some seconds may be longer than others). An instant may jump forwards or
|
||||
/// experience time dilation (slow down or speed up), but it will never go
|
||||
|
|
|
@ -60,7 +60,7 @@ pub mod point {
|
|||
}
|
||||
}
|
||||
|
||||
/// A fn that has the changed type in its signature; must currently be
|
||||
/// A function that has the changed type in its signature; must currently be
|
||||
/// rebuilt.
|
||||
///
|
||||
/// You could imagine that, in the future, if the change were
|
||||
|
@ -76,7 +76,7 @@ pub mod fn_with_type_in_sig {
|
|||
}
|
||||
}
|
||||
|
||||
/// Call a fn that has the changed type in its signature; this
|
||||
/// Call a function that has the changed type in its signature; this
|
||||
/// currently must also be rebuilt.
|
||||
///
|
||||
/// You could imagine that, in the future, if the change were
|
||||
|
@ -92,7 +92,7 @@ pub mod call_fn_with_type_in_sig {
|
|||
}
|
||||
}
|
||||
|
||||
/// A fn that uses the changed type, but only in its body, not its
|
||||
/// A function that uses the changed type, but only in its body, not its
|
||||
/// signature.
|
||||
///
|
||||
/// You could imagine that, in the future, if the change were
|
||||
|
@ -108,10 +108,10 @@ pub mod fn_with_type_in_body {
|
|||
}
|
||||
}
|
||||
|
||||
/// A fn X that calls a fn Y, where Y uses the changed type in its
|
||||
/// A function `X` that calls a function `Y`, where `Y` uses the changed type in its
|
||||
/// body. In this case, the effects of the change should be contained
|
||||
/// to Y; X should not have to be rebuilt, nor should it need to be
|
||||
/// typechecked again.
|
||||
/// to `Y`; `X` should not have to be rebuilt, nor should it need to be
|
||||
/// type-checked again.
|
||||
pub mod call_fn_with_type_in_body {
|
||||
use fn_with_type_in_body;
|
||||
|
||||
|
@ -121,7 +121,7 @@ pub mod call_fn_with_type_in_body {
|
|||
}
|
||||
}
|
||||
|
||||
/// A fn item that makes an instance of `Point` but does not invoke methods
|
||||
/// A function item that makes an instance of `Point` but does not invoke methods.
|
||||
pub mod fn_make_struct {
|
||||
use point::Point;
|
||||
|
||||
|
@ -131,7 +131,7 @@ pub mod fn_make_struct {
|
|||
}
|
||||
}
|
||||
|
||||
/// A fn item that reads fields from `Point` but does not invoke methods
|
||||
/// A function item that reads fields from `Point` but does not invoke methods.
|
||||
pub mod fn_read_field {
|
||||
use point::Point;
|
||||
|
||||
|
@ -141,7 +141,7 @@ pub mod fn_read_field {
|
|||
}
|
||||
}
|
||||
|
||||
/// A fn item that writes to a field of `Point` but does not invoke methods
|
||||
/// A function item that writes to a field of `Point` but does not invoke methods.
|
||||
pub mod fn_write_field {
|
||||
use point::Point;
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ fn make_x() -> P<Expr> {
|
|||
expr(ExprKind::Path(None, path))
|
||||
}
|
||||
|
||||
/// Iterate over exprs of depth up to `depth`. The goal is to explore all "interesting"
|
||||
/// combinations of expression nesting. For example, we explore combinations using `if`, but not
|
||||
/// Iterate over exprs of depth up to `depth`. The goal is to explore all "interesting"
|
||||
/// combinations of expression nesting. For example, we explore combinations using `if`, but not
|
||||
/// `while` or `match`, since those should print and parse in much the same way as `if`.
|
||||
fn iter_exprs(depth: usize, f: &mut FnMut(P<Expr>)) {
|
||||
if depth == 0 {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! This is a client of the `a` crate defined in "svn-a-base.rs". The
|
||||
//! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use
|
||||
//! This is a client of the `a` crate defined in `svn-a-base.rs`. The
|
||||
//! rpass and cfail tests (such as `run-pass/svh-add-comment.rs`) use
|
||||
//! it by swapping in a different object code library crate built from
|
||||
//! some variant of "svn-a-base.rs", and then we are checking if the
|
||||
//! some variant of `svn-a-base.rs`, and then we are checking if the
|
||||
//! compiler properly ignores or accepts the change, based on whether
|
||||
//! the change could affect the downstream crate content or not
|
||||
//! (#14132).
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/*
|
||||
# Comparison of static arrays
|
||||
|
||||
The expected behaviour would be that test==test1, therefore 'true'
|
||||
The expected behaviour would be that `test == test1`, therefore 'true'
|
||||
would be printed, however the below prints false.
|
||||
*/
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ mod test_foreign_items {
|
|||
}
|
||||
|
||||
|
||||
// FIXME #623 - these aren't supported yet
|
||||
// FIXME(#623): - these aren't supported yet
|
||||
/*mod test_literals {
|
||||
#![str = "s"]
|
||||
#![char = 'c']
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/*!
|
||||
* On x86_64-linux-gnu and possibly other platforms, structs get 8-byte "preferred" alignment,
|
||||
* but their "ABI" alignment (i.e., what actually matters for data layout) is the largest alignment
|
||||
* of any field. (Also, u64 has 8-byte ABI alignment; this is not always true).
|
||||
* of any field. (Also, `u64` has 8-byte ABI alignment; this is not always true).
|
||||
*
|
||||
* On such platforms, if monomorphize uses the "preferred" alignment, then it will unify
|
||||
* `A` and `B`, even though `S<A>` and `S<B>` have the field `t` at different offsets,
|
||||
|
|
|
@ -175,7 +175,7 @@ fn test_op_assigns() {
|
|||
assert_eq!(black_box(tmp), Wrapping($ans));
|
||||
}
|
||||
|
||||
// FIXME(30524): Uncomment this test
|
||||
// FIXME(30524): uncomment this test
|
||||
/*
|
||||
{
|
||||
let mut tmp = Wrapping($initial);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
//! This crate exports a macro `enum_from_primitive!` that wraps an
|
||||
//! `enum` declaration and automatically adds an implementation of
|
||||
//! `num::FromPrimitive` (reexported here), to allow conversion from
|
||||
//! primitive integers to the enum. It therefore provides an
|
||||
//! primitive integers to the enum. It therefore provides an
|
||||
//! alternative to the built-in `#[derive(FromPrimitive)]`, which
|
||||
//! requires the unstable `std::num::FromPrimitive` and is disabled in
|
||||
//! Rust 1.0.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/// Test | Table
|
||||
/// Tests | Table
|
||||
/// ------|-------------
|
||||
/// t = b | id = \|x\| x
|
||||
pub struct Foo; // @has issue_27862/struct.Foo.html //td 'id = |x| x'
|
||||
|
|
|
@ -41,7 +41,7 @@ impl ToOwned for u8 {
|
|||
pub trait ToOwned {
|
||||
type Owned;
|
||||
|
||||
/// Create owned data from borrowed data, usually by copying.
|
||||
/// Creates owned data from borrowed data, usually by copying.
|
||||
fn to_owned(&self) -> Self::Owned;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ impl PathExtensions for PathBuf {}
|
|||
/// A strategy for acquiring more subpaths to walk.
|
||||
pub trait Strategy {
|
||||
type P: PathExtensions;
|
||||
/// Get additional subpaths from a given path.
|
||||
/// Gets additional subpaths from a given path.
|
||||
fn get_more(&self, item: &Self::P) -> io::Result<Vec<Self::P>>;
|
||||
/// Determine whether a path should be walked further.
|
||||
/// This is run against each item from `get_more()`.
|
||||
|
@ -44,7 +44,7 @@ pub struct Subpaths<S: Strategy> {
|
|||
}
|
||||
|
||||
impl<S: Strategy> Subpaths<S> {
|
||||
/// Create a directory walker with a root path and strategy.
|
||||
/// Creates a directory walker with a root path and strategy.
|
||||
pub fn new(p: &S::P, strategy: S) -> io::Result<Subpaths<S>> {
|
||||
let stack = strategy.get_more(p)?;
|
||||
Ok(Subpaths { stack: stack, strategy: strategy })
|
||||
|
@ -52,7 +52,7 @@ impl<S: Strategy> Subpaths<S> {
|
|||
}
|
||||
|
||||
impl<S: Default + Strategy> Subpaths<S> {
|
||||
/// Create a directory walker with a root path and a default strategy.
|
||||
/// Creates a directory walker with a root path and a default strategy.
|
||||
pub fn walk(p: &S::P) -> io::Result<Subpaths<S>> {
|
||||
Subpaths::new(p, Default::default())
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
struct S {
|
||||
x: u8,
|
||||
/// The id of the parent core
|
||||
/// The ID of the parent core
|
||||
y: u8,
|
||||
}
|
||||
//~^^^ ERROR found a documentation comment that doesn't document anything
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
struct S {
|
||||
x: u8
|
||||
/// The id of the parent core
|
||||
/// The ID of the parent core
|
||||
y: u8,
|
||||
}
|
||||
//~^^^ ERROR found a documentation comment that doesn't document anything
|
||||
|
|
|
@ -27,7 +27,7 @@ impl<'l> AddAssign for Counter<'l>
|
|||
}
|
||||
}
|
||||
|
||||
/// often times crashes, if not prints invalid strings
|
||||
/// Often crashes, if not prints invalid strings.
|
||||
pub fn panics() {
|
||||
let mut acc = Counter{map: HashMap::new()};
|
||||
for line in vec!["123456789".to_string(), "12345678".to_string()] {
|
||||
|
|
|
@ -18,7 +18,7 @@ pub trait NodeCodec<H: Hasher> {
|
|||
}
|
||||
|
||||
pub trait Trie<H: Hasher, C: NodeCodec<H>> {
|
||||
/// Return the root of the trie.
|
||||
/// Returns the root of the trie.
|
||||
fn root(&self) -> &H::Out;
|
||||
|
||||
/// Is the trie empty?
|
||||
|
|
|
@ -10,7 +10,7 @@ trait Foo<Bar, Baz, Quux>
|
|||
|
||||
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
|
||||
trait MyFromIterator<A> {
|
||||
/// Build a container with elements from an external iterator.
|
||||
/// Builds a container with elements from an external iterator.
|
||||
fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ fn foobar<U: Clone, T: Foo<u8, U, u32>>() -> T {
|
|||
|
||||
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
|
||||
trait MyFromIterator<A> {
|
||||
/// Build a container with elements from an external iterator.
|
||||
/// Builds a container with elements from an external iterator.
|
||||
fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! This is a client of the `a` crate defined in "svn-a-base.rs". The
|
||||
//! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use
|
||||
//! This is a client of the `a` crate defined in `svn-a-base.rs`. The
|
||||
//! rpass and cfail tests (such as `run-pass/svh-add-comment.rs`) use
|
||||
//! it by swapping in a different object code library crate built from
|
||||
//! some variant of "svn-a-base.rs", and then we are checking if the
|
||||
//! some variant of `svn-a-base.rs`, and then we are checking if the
|
||||
//! compiler properly ignores or accepts the change, based on whether
|
||||
//! the change could affect the downstream crate content or not
|
||||
//! (#14132).
|
||||
|
|
Loading…
Add table
Reference in a new issue