Skip to content

Commit

Permalink
tests: doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Regueiro committed Feb 10, 2019
1 parent c3e182c commit b87363e
Show file tree
Hide file tree
Showing 61 changed files with 164 additions and 164 deletions.
6 changes: 3 additions & 3 deletions src/liballoc/collections/btree/node.rs
Expand Up @@ -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 = ()> {
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/collections/vec_deque.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/liballoc/fmt.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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`]
Expand Down Expand Up @@ -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>`.
//!
Expand Down
6 changes: 3 additions & 3 deletions src/liballoc/macros.rs
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/vec.rs
Expand Up @@ -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`].
///
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/alloc.rs
Expand Up @@ -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.
///
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/any.rs
Expand Up @@ -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.
Expand All @@ -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) => {
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/cell.rs
Expand Up @@ -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")]
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/cmp.rs
Expand Up @@ -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`):
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/convert.rs
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/intrinsics.rs
@@ -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
//!
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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].
///
Expand Down Expand Up @@ -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
Expand All @@ -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].
///
Expand Down
10 changes: 5 additions & 5 deletions src/libcore/iter/traits/iterator.rs
Expand Up @@ -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`.
///
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/macros.rs
Expand Up @@ -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.
///
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/mem.rs
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
///
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/num/dec2flt/mod.rs
Expand Up @@ -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.
Expand Down Expand Up @@ -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> {
Expand Down Expand Up @@ -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..]),
Expand Down
10 changes: 5 additions & 5 deletions src/libcore/num/dec2flt/rawfp.rs
Expand Up @@ -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.
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/ops/arith.rs
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/ops/try.rs
@@ -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")]
Expand Down

0 comments on commit b87363e

Please sign in to comment.