tests: doc comments

This commit is contained in:
Alexander Regueiro 2019-02-09 21:23:30 +00:00
parent c3e182cf43
commit b87363e763
61 changed files with 164 additions and 164 deletions

View File

@ -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 /// 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 /// 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. /// `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`.) /// 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! /// because the size of `NodeHeader` depends on its alignment!
#[repr(C)] #[repr(C)]
struct NodeHeader<K, V, K2 = ()> { struct NodeHeader<K, V, K2 = ()> {

View File

@ -1922,7 +1922,7 @@ impl<T> VecDeque<T> {
/// ///
/// # Panics /// # 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. /// does _not_ panic and is a no-op rotation.
/// ///
/// # Complexity /// # Complexity
@ -1967,7 +1967,7 @@ impl<T> VecDeque<T> {
/// ///
/// # Panics /// # 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. /// does _not_ panic and is a no-op rotation.
/// ///
/// # Complexity /// # Complexity

View File

@ -27,7 +27,7 @@
//! will then parse the format string and determine if the list of arguments //! will then parse the format string and determine if the list of arguments
//! provided is suitable to pass to this format string. //! 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. //! will use the [`Display`] formatting trait.
//! //!
//! ## Positional parameters //! ## Positional parameters
@ -102,7 +102,7 @@
//! When requesting that an argument be formatted with a particular type, you //! When requesting that an argument be formatted with a particular type, you
//! are actually requesting that an argument ascribes to a particular trait. //! are actually requesting that an argument ascribes to a particular trait.
//! This allows multiple actual types to be formatted via `{:x}` (like [`i8`] as //! 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`] //! * *nothing* ⇒ [`Display`]
//! * `?` ⇒ [`Debug`] //! * `?` ⇒ [`Debug`]
@ -427,7 +427,7 @@
//! 3. An asterisk `.*`: //! 3. An asterisk `.*`:
//! //!
//! `.*` means that this `{...}` is associated with *two* format inputs rather than one: the //! `.*` 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 //! 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>`. //! to the *value* to print, and the `precision` must come in the input preceding `<arg>`.
//! //!

View File

@ -62,8 +62,8 @@ macro_rules! vec {
/// Creates a `String` using interpolation of runtime expressions. /// Creates a `String` using interpolation of runtime expressions.
/// ///
/// The first argument `format!` receives is a format string. This must be a string /// 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. /// literal. The power of the formatting string is in the `{}`s contained.
/// ///
/// Additional parameters passed to `format!` replace the `{}`s within the /// Additional parameters passed to `format!` replace the `{}`s within the
/// formatting string in the order given unless named or positional parameters /// 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, /// The same convention is used with [`print!`] and [`write!`] macros,
/// depending on the intended destination of the string. /// 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. /// will use the [`Display`] formatting trait.
/// ///
/// [fmt]: ../std/fmt/index.html /// [fmt]: ../std/fmt/index.html

View File

@ -738,7 +738,7 @@ impl<T> Vec<T> {
/// Forces the length of the vector to `new_len`. /// Forces the length of the vector to `new_len`.
/// ///
/// This is a low-level operation that maintains none of the normal /// 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 /// is done using one of the safe operations instead, such as
/// [`truncate`], [`resize`], [`extend`], or [`clear`]. /// [`truncate`], [`resize`], [`extend`], or [`clear`].
/// ///

View File

@ -425,7 +425,7 @@ impl fmt::Display for CannotReallocInPlace {
/// The `GlobalAlloc` trait is an `unsafe` trait for a number of reasons, and /// The `GlobalAlloc` trait is an `unsafe` trait for a number of reasons, and
/// implementors must ensure that they adhere to these contracts: /// 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 /// be lifted in the future, but currently a panic from any of these
/// functions may lead to memory unsafety. /// functions may lead to memory unsafety.
/// ///

View File

@ -18,7 +18,7 @@
//! //!
//! Consider a situation where we want to log out a value passed to a function. //! 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 //! 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. //! 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 //! We don't know the concrete type of our value at compile time, so we need to
//! use runtime reflection instead. //! use runtime reflection instead.
@ -31,8 +31,8 @@
//! fn log<T: Any + Debug>(value: &T) { //! fn log<T: Any + Debug>(value: &T) {
//! let value_any = value as &dyn Any; //! let value_any = value as &dyn Any;
//! //!
//! // try to convert our value to a String. If successful, we want to //! // 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 //! // output the String`'s length as well as its value. If not, it's a
//! // different type: just print it out unadorned. //! // different type: just print it out unadorned.
//! match value_any.downcast_ref::<String>() { //! match value_any.downcast_ref::<String>() {
//! Some(as_string) => { //! Some(as_string) => {

View File

@ -1133,7 +1133,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
/// The `RefCell` is already immutably borrowed, so this cannot fail. /// The `RefCell` is already immutably borrowed, so this cannot fail.
/// ///
/// This is an associated function that needs to be used as /// 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 /// with the widespread use of `r.borrow().clone()` to clone the contents of
/// a `RefCell`. /// a `RefCell`.
#[stable(feature = "cell_extras", since = "1.15.0")] #[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. /// borrowed data.
/// ///
/// The `RefCell` is already immutably borrowed, so this cannot fail. /// 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. /// The `RefCell` is already mutably borrowed, so this cannot fail.
/// ///
/// This is an associated function that needs to be used as /// 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`. /// name on the contents of a `RefCell` used through `Deref`.
/// ///
/// # Examples /// # 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. /// borrowed data.
/// ///
/// The underlying `RefCell` will remain mutably borrowed until both /// The underlying `RefCell` will remain mutably borrowed until both

View File

@ -26,7 +26,7 @@ use self::Ordering::*;
/// relations](http://en.wikipedia.org/wiki/Partial_equivalence_relation). /// relations](http://en.wikipedia.org/wiki/Partial_equivalence_relation).
/// ///
/// This trait allows for partial equality, for types that do not have a full /// 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`. /// so floating point types implement `PartialEq` but not `Eq`.
/// ///
/// Formally, the equality must be (for all `a`, `b` and `c`): /// Formally, the equality must be (for all `a`, `b` and `c`):

View File

@ -217,7 +217,7 @@ pub trait AsMut<T: ?Sized> {
/// ///
/// There is one exception to implementing `Into`, and it's kind of esoteric. /// 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 /// 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: /// take this crate:
/// ///
/// ```compile_fail /// ```compile_fail

View File

@ -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 //! # Volatiles
//! //!
@ -697,7 +697,7 @@ extern "rust-intrinsic" {
/// Creates a value initialized to zero. /// Creates a value initialized to zero.
/// ///
/// `init` is unsafe because it returns a zeroed-out datum, /// `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 /// `Copy`, an all-zero value may not correspond to any legitimate
/// state for the type in question. /// state for the type in question.
pub fn init<T>() -> T; pub fn init<T>() -> T;
@ -988,7 +988,7 @@ extern "rust-intrinsic" {
/// beginning at `dst` with the same size. /// beginning at `dst` with the same size.
/// ///
/// Like [`read`], `copy_nonoverlapping` creates a bitwise copy of `T`, regardless of /// 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 /// in the region beginning at `*src` and the region beginning at `*dst` can
/// [violate memory safety][read-ownership]. /// [violate memory safety][read-ownership].
/// ///
@ -1055,7 +1055,7 @@ extern "rust-intrinsic" {
/// [`copy_nonoverlapping`] can be used instead. /// [`copy_nonoverlapping`] can be used instead.
/// ///
/// `copy` is semantically equivalent to C's [`memmove`], but with the argument /// `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`. /// to a temporary array and then copied from the array to `dst`.
/// ///
/// [`copy_nonoverlapping`]: ./fn.copy_nonoverlapping.html /// [`copy_nonoverlapping`]: ./fn.copy_nonoverlapping.html
@ -1072,7 +1072,7 @@ extern "rust-intrinsic" {
/// * Both `src` and `dst` must be properly aligned. /// * Both `src` and `dst` must be properly aligned.
/// ///
/// Like [`read`], `copy` creates a bitwise copy of `T`, regardless of /// 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 /// in the region beginning at `*src` and the region beginning at `*dst` can
/// [violate memory safety][read-ownership]. /// [violate memory safety][read-ownership].
/// ///

View File

@ -564,9 +564,9 @@ pub trait Iterator {
/// Calls a closure on each element of an iterator. /// Calls a closure on each element of an iterator.
/// ///
/// This is equivalent to using a [`for`] loop on the iterator, although /// 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 /// 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 /// cases `for_each` may also be faster than a loop, because it will use
/// internal iteration on adaptors like `Chain`. /// internal iteration on adaptors like `Chain`.
/// ///
@ -1515,7 +1515,7 @@ pub trait Iterator {
/// is propagated back to the caller immediately (short-circuiting). /// is propagated back to the caller immediately (short-circuiting).
/// ///
/// The initial value is the value the accumulator will have on the first /// 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. /// iterator, `try_fold()` returns the final accumulator as success.
/// ///
/// Folding is useful whenever you have a collection of something, and want /// 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. /// do something better than the default `for` loop implementation.
/// ///
/// In particular, try to have this call `try_fold()` on the internal parts /// 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 /// the `?` operator may be convenient for chaining the accumulator value
/// along, but beware any invariants that need to be upheld before those /// 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. /// resumable after hitting an error here.
/// ///
/// # Examples /// # Examples

View File

@ -432,7 +432,7 @@ macro_rules! writeln {
/// * Iterators that dynamically terminate. /// * Iterators that dynamically terminate.
/// ///
/// If the determination that the code is unreachable proves incorrect, the /// 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 /// which belongs to the [`std::hint`] module, informs the compiler to
/// optimize the code out of the release version entirely. /// optimize the code out of the release version entirely.
/// ///

View File

@ -1101,7 +1101,7 @@ impl<T> MaybeUninit<T> {
} }
/// Create a new `MaybeUninit` in an uninitialized state, with the memory being /// 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, /// proper initialization. For example, `MaybeUninit<usize>::zeroed()` is initialized,
/// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not /// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not
/// be null. /// 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 /// to ensure that the data will get dropped, because the resulting `T` is
/// subject to the usual drop handling. /// subject to the usual drop handling.
/// ///

View File

@ -37,7 +37,7 @@
//! //!
//! In addition, there are numerous helper functions that are used in the paper but not available //! 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 //! 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 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 //! Algorithm M (with the modifications described in section 8 of the paper) well before the
//! inputs get into the critical region. //! inputs get into the critical region.
@ -148,7 +148,7 @@ macro_rules! from_str_float_impl {
/// # Return value /// # Return value
/// ///
/// `Err(ParseFloatError)` if the string did not represent a valid /// `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`. /// number represented by `src`.
#[inline] #[inline]
fn from_str(src: &str) -> Result<Self, ParseFloatError> { fn from_str(src: &str) -> Result<Self, ParseFloatError> {
@ -209,7 +209,7 @@ fn pfe_invalid() -> ParseFloatError {
ParseFloatError { kind: FloatErrorKind::Invalid } 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) { fn extract_sign(s: &str) -> (Sign, &str) {
match s.as_bytes()[0] { match s.as_bytes()[0] {
b'+' => (Sign::Positive, &s[1..]), b'+' => (Sign::Positive, &s[1..]),

View File

@ -59,10 +59,10 @@ pub trait RawFloat
/// Type used by `to_bits` and `from_bits`. /// Type used by `to_bits` and `from_bits`.
type Bits: Add<Output = Self::Bits> + From<u8> + TryFrom<u64>; 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; fn to_bits(self) -> Self::Bits;
/// Raw transmutation from integer. /// Performs a raw transmutation from an integer.
fn from_bits(v: Self::Bits) -> Self; fn from_bits(v: Self::Bits) -> Self;
/// Returns the category that this number falls into. /// Returns the category that this number falls into.
@ -71,14 +71,14 @@ pub trait RawFloat
/// Returns the mantissa, exponent and sign as integers. /// Returns the mantissa, exponent and sign as integers.
fn integer_decode(self) -> (u64, i16, i8); fn integer_decode(self) -> (u64, i16, i8);
/// Decode the float. /// Decodes the float.
fn unpack(self) -> Unpacked; 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. /// represented, the other code in this module makes sure to never let that happen.
fn from_int(x: u64) -> Self; 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`. /// Panics for `e >= CEIL_LOG5_OF_MAX_SIG`.
fn short_fast_pow10(e: usize) -> Self; fn short_fast_pow10(e: usize) -> Self;

View File

@ -518,7 +518,7 @@ pub trait Rem<RHS=Self> {
macro_rules! rem_impl_integer { macro_rules! rem_impl_integer {
($($t:ty)*) => ($( ($($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. /// result has the same sign as the left operand.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl Rem for $t { impl Rem for $t {

View File

@ -1,7 +1,7 @@
/// A trait for customizing the behavior of the `?` operator. /// A trait for customizing the behavior of the `?` operator.
/// ///
/// A type implementing `Try` is one that has a canonical way to view it /// 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 /// extracting those success or failure values from an existing instance and
/// creating a new instance from a success or failure value. /// creating a new instance from a success or failure value.
#[unstable(feature = "try_trait", issue = "42327")] #[unstable(feature = "try_trait", issue = "42327")]

View File

@ -12,7 +12,7 @@
//! to access only a single value, in which case the documentation omits the size //! to access only a single value, in which case the documentation omits the size
//! and implicitly assumes it to be `size_of::<T>()` bytes. //! 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: //! provided at this point are very minimal:
//! //!
//! * A [null] pointer is *never* valid, not even for accesses of [size zero][zst]. //! * 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 [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. /// an unaligned pointer.
/// ///
/// Additionally, if `T` is not [`Copy`], using the pointed-to value after /// Additionally, if `T` is not [`Copy`], using the pointed-to value after
@ -135,7 +135,7 @@ pub use intrinsics::write_bytes;
/// unsafe { /// unsafe {
/// // Get a raw pointer to the last element in `v`. /// // Get a raw pointer to the last element in `v`.
/// let ptr = &mut v[1] as *mut _; /// 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. /// // to prevent issues if the `drop_in_place` below panics.
/// v.set_len(1); /// v.set_len(1);
/// // Without a call `drop_in_place`, the last item would never be dropped, /// // 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`]. /// `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 /// 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`. /// use because it will attempt to drop the value at `*src`.
/// ///
/// [`write`] can be used to overwrite data without causing it to be dropped. /// [`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. /// * `src` must be [valid] for reads.
/// ///
/// Like [`read`], `read_unaligned` creates a bitwise copy of `T`, regardless of /// 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]. /// 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. /// 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. /// * `src` must be properly aligned.
/// ///
/// Like [`read`], `read_unaligned` creates a bitwise copy of `T`, regardless of /// 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]. /// value and the value at `*src` can [violate memory safety][read-ownership].
/// However, storing non-[`Copy`] types in volatile memory is almost certainly /// However, storing non-[`Copy`] types in volatile memory is almost certainly
/// incorrect. /// incorrect.
@ -1093,7 +1093,7 @@ impl<T: ?Sized> *const T {
/// unless `x` and `y` point into the same allocated object. /// unless `x` and `y` point into the same allocated object.
/// ///
/// Always use `.offset(count)` instead when possible, because `offset` /// 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. /// boundaries, cast the pointer to an integer and do the arithmetic there.
/// ///
/// # Examples /// # Examples
@ -1712,7 +1712,7 @@ impl<T: ?Sized> *mut T {
/// unless `x` and `y` point into the same allocated object. /// unless `x` and `y` point into the same allocated object.
/// ///
/// Always use `.offset(count)` instead when possible, because `offset` /// 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. /// boundaries, cast the pointer to an integer and do the arithmetic there.
/// ///
/// # Examples /// # Examples

View File

@ -1197,7 +1197,7 @@ impl<T> [T] {
/// Returns an iterator over subslices separated by elements that match /// Returns an iterator over subslices separated by elements that match
/// `pred` limited to returning at most `n` items. This starts at the end of /// `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 subslices.
/// ///
/// The last element returned, if any, will contain the remainder of the /// 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> {} unsafe impl<T: Sync> Send for Iter<'_, T> {}
impl<'a, T> Iter<'a, 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 /// This has the same lifetime as the original slice, and so the
/// iterator can continue to be used while this exists. /// 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> {} unsafe impl<T: Send> Send for IterMut<'_, T> {}
impl<'a, T> IterMut<'a, 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 avoid creating `&mut` references that alias, this is forced
/// to consume the iterator. /// to consume the iterator.

View File

@ -26,7 +26,7 @@ impl<T> RawArray<T> {
} }
/// Rotates the range `[mid-left, mid+right)` such that the element at `mid` /// 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. /// elements to the left or `right` elements to the right.
/// ///
/// # Safety /// # Safety
@ -36,10 +36,10 @@ impl<T> RawArray<T> {
/// # Algorithm /// # Algorithm
/// ///
/// For longer rotations, swap the left-most `delta = min(left, right)` /// 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" /// 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 /// rotation. Doing this puts `delta` elements on the larger side into the
/// correct position, leaving a smaller rotate problem. Demonstration: /// correct position, leaving a smaller rotate problem. Demonstration:
/// ///
/// ```text /// ```text
/// [ 6 7 8 9 10 11 12 13 . 1 2 3 4 5 ] /// [ 6 7 8 9 10 11 12 13 . 1 2 3 4 5 ]

View File

@ -612,7 +612,7 @@ impl<'a> DoubleEndedIterator for Chars<'a> {
impl FusedIterator for Chars<'_> {} impl FusedIterator for Chars<'_> {}
impl<'a> Chars<'a> { 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 /// This has the same lifetime as the original slice, and so the
/// iterator can continue to be used while this exists. /// iterator can continue to be used while this exists.
@ -702,7 +702,7 @@ impl<'a> DoubleEndedIterator for CharIndices<'a> {
impl FusedIterator for CharIndices<'_> {} impl FusedIterator for CharIndices<'_> {}
impl<'a> CharIndices<'a> { 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 /// This has the same lifetime as the original slice, and so the
/// iterator can continue to be used while this exists. /// iterator can continue to be used while this exists.
@ -1579,9 +1579,9 @@ mod traits {
/// Implements ordering of strings. /// Implements ordering of strings.
/// ///
/// Strings are ordered lexicographically by their byte values. This orders Unicode code /// 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 /// 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 /// "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 /// culturally-accepted standards requires locale-specific data that is outside the scope of
/// the `str` type. /// the `str` type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -1607,9 +1607,9 @@ mod traits {
/// Implements comparison operations on strings. /// Implements comparison operations on strings.
/// ///
/// Strings are compared lexicographically by their byte values. This compares Unicode code /// 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 /// 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 /// "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 /// culturally-accepted standards requires locale-specific data that is outside the scope of
/// the `str` type. /// the `str` type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -2643,7 +2643,7 @@ impl str {
Bytes(self.as_bytes().iter().cloned()) 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 iterator returned will return string slices that are sub-slices of
/// the original string slice, separated by any amount of whitespace. /// the original string slice, separated by any amount of whitespace.
@ -2686,7 +2686,7 @@ impl str {
SplitWhitespace { inner: self.split(IsWhitespace).filter(IsNotEmpty) } 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 iterator returned will return string slices that are sub-slices of
/// the original string slice, separated by any amount of ASCII whitespace. /// the original string slice, separated by any amount of ASCII whitespace.

View File

@ -43,7 +43,7 @@ pub const NANOSECOND: Duration = Duration::from_nanos(1);
/// timeouts. /// timeouts.
/// ///
/// Each `Duration` is composed of a whole number of seconds and a fractional part /// 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 /// nanosecond-level precision, APIs binding a system timeout will typically round up
/// the number of nanoseconds. /// the number of nanoseconds.
/// ///

View File

@ -38,7 +38,7 @@ impl<T: LambdaL> ScopedCell<T> {
ScopedCell(Cell::new(value)) 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. /// running `f`, which gets the old value, mutably.
/// The old value will be restored after `f` exits, even /// The old value will be restored after `f` exits, even
/// by panic, including modifications made to it by `f`. /// 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())) 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 { pub fn set<'a, R>(&self, value: <T as ApplyL<'a>>::Out, f: impl FnOnce() -> R) -> R {
self.replace(value, |_| f()) self.replace(value, |_| f())
} }

View File

@ -56,7 +56,7 @@ pub struct Diagnostic {
macro_rules! diagnostic_child_methods { macro_rules! diagnostic_child_methods {
($spanned:ident, $regular:ident, $level:expr) => ( ($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 /// identified by this method's name with the given `spans` and
/// `message`. /// `message`.
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")] #[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
@ -67,7 +67,7 @@ macro_rules! diagnostic_child_methods {
self 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`. /// identified by this method's name with the given `message`.
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")] #[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
pub fn $regular<T: Into<String>>(mut self, message: T) -> Diagnostic { 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")] #[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
impl Diagnostic { 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")] #[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
pub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic { pub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic {
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`. /// the given set of `spans`.
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")] #[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
pub fn spanned<S, T>(spans: S, level: Level, message: T) -> Diagnostic pub fn spanned<S, T>(spans: S, level: Level, message: T) -> Diagnostic

View File

@ -88,7 +88,7 @@ impl TokenStream {
/// or characters not existing in the language. /// or characters not existing in the language.
/// All tokens in the parsed stream get `Span::call_site()` spans. /// 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. /// change these errors into `LexError`s later.
#[stable(feature = "proc_macro_lib", since = "1.15.0")] #[stable(feature = "proc_macro_lib", since = "1.15.0")]
impl FromStr for TokenStream { impl FromStr for TokenStream {
@ -244,7 +244,7 @@ impl !Sync for Span {}
macro_rules! diagnostic_method { macro_rules! diagnostic_method {
($name:ident, $level:expr) => ( ($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`. /// `self`.
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")] #[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
pub fn $name<T: Into<String>>(self, message: T) -> Diagnostic { pub fn $name<T: Into<String>>(self, message: T) -> Diagnostic {
@ -290,19 +290,19 @@ impl Span {
Span(self.0.source()) 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")] #[unstable(feature = "proc_macro_span", issue = "54725")]
pub fn start(&self) -> LineColumn { pub fn start(&self) -> LineColumn {
self.0.start() 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")] #[unstable(feature = "proc_macro_span", issue = "54725")]
pub fn end(&self) -> LineColumn { pub fn end(&self) -> LineColumn {
self.0.end() 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. /// Returns `None` if `self` and `other` are from different files.
#[unstable(feature = "proc_macro_span", issue = "54725")] #[unstable(feature = "proc_macro_span", issue = "54725")]
@ -368,7 +368,7 @@ impl !Sync for LineColumn {}
pub struct SourceFile(bridge::client::SourceFile); pub struct SourceFile(bridge::client::SourceFile);
impl SourceFile { impl SourceFile {
/// Get the path to this source file. /// Gets the path to this source file.
/// ///
/// ### Note /// ### Note
/// If the code span associated with this `SourceFile` was generated by an external macro, this /// If the code span associated with this `SourceFile` was generated by an external macro, this

View File

@ -250,7 +250,7 @@ impl f64 {
/// Calculates the least nonnegative remainder of `self (mod rhs)`. /// Calculates the least nonnegative remainder of `self (mod rhs)`.
/// ///
/// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in /// 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 /// result in `r == rhs.abs()`, violating the mathematical definition, if
/// `self` is much smaller than `rhs.abs()` in magnitude and `self < 0.0`. /// `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 /// This result is not an element of the function's codomain, but it is the

View File

@ -24,7 +24,7 @@ use sys_common::{AsInner, IntoInner, FromInner};
/// ///
/// `OsString` and [`OsStr`] bridge this gap by simultaneously representing Rust /// `OsString` and [`OsStr`] bridge this gap by simultaneously representing Rust
/// and platform-native string values, and in particular allowing a Rust string /// 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 /// 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`]. /// to pass to e.g., Unix system call, you should create a [`CStr`].
/// ///

View File

@ -222,7 +222,7 @@ fn initial_buffer_size(file: &File) -> usize {
/// Read the entire contents of a file into a bytes vector. /// Read the entire contents of a file into a bytes vector.
/// ///
/// This is a convenience function for using [`File::open`] and [`read_to_end`] /// 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 /// buffer based on the file size when available, so it is generally faster than
/// reading into a vector created with `Vec::new()`. /// 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. /// Read the entire contents of a file into a string.
/// ///
/// This is a convenience function for using [`File::open`] and [`read_to_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 /// buffer based on the file size when available, so it is generally faster than
/// reading into a string created with `String::new()`. /// reading into a string created with `String::new()`.
/// ///

View File

@ -16,9 +16,9 @@ use memchr;
/// the underlying [`Read`] and maintains an in-memory buffer of the results. /// the underlying [`Read`] and maintains an in-memory buffer of the results.
/// ///
/// `BufReader` can improve the speed of programs that make *small* and /// `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 /// 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>`. /// already in memory, like a `Vec<u8>`.
/// ///
/// [`Read`]: ../../std/io/trait.Read.html /// [`Read`]: ../../std/io/trait.Read.html
@ -331,9 +331,9 @@ impl<R: Seek> Seek for BufReader<R> {
/// writer in large, infrequent batches. /// writer in large, infrequent batches.
/// ///
/// `BufWriter` can improve the speed of programs that make *small* and /// `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 /// 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>`. /// in memory, like a `Vec<u8>`.
/// ///
/// When the `BufWriter` is dropped, the contents of its buffer will be written /// When the `BufWriter` is dropped, the contents of its buffer will be written

View File

@ -627,7 +627,7 @@ mod loop_keyword { }
/// directly accessed and modified. /// directly accessed and modified.
/// ///
/// Tuple structs are similar to regular structs, but its fields have no names. They are used like /// 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`, /// individual variables, the same syntax is used as with regular tuples, namely `foo.0`, `foo.1`,
/// etc, starting at zero. /// etc, starting at zero.
/// ///

View File

@ -11,8 +11,8 @@
/// an unrecoverable problem. /// an unrecoverable problem.
/// ///
/// This macro is the perfect way to assert conditions in example code and in /// 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`] /// tests. `panic!` is closely tied with the `unwrap` method of both [`Option`]
/// and [`Result`][runwrap] enums. Both implementations call `panic!` when they are set /// and [`Result`][runwrap] enums. Both implementations call `panic!` when they are set
/// to None or Err variants. /// to None or Err variants.
/// ///
/// This macro is used to inject panic into a Rust thread, causing the thread to /// This macro is used to inject panic into a Rust thread, causing the thread to
@ -21,7 +21,7 @@
/// is transmitted. /// is transmitted.
/// ///
/// [`Result`] enum is often a better solution for recovering from errors than /// [`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 /// incorrect values, such as from external sources. Detailed information about
/// error handling is found in the [book]. /// 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 /// necessary to use [`io::stdout().flush()`][flush] to ensure the output is emitted
/// immediately. /// 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. /// [`eprint!`] instead to print error and progress messages.
/// ///
/// [`println!`]: ../std/macro.println.html /// [`println!`]: ../std/macro.println.html
@ -124,7 +124,7 @@ macro_rules! print {
/// Use the [`format!`] syntax to write data to the standard output. /// Use the [`format!`] syntax to write data to the standard output.
/// See [`std::fmt`] for more information. /// 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. /// [`eprintln!`] instead to print error and progress messages.
/// ///
/// [`format!`]: ../std/macro.format.html /// [`format!`]: ../std/macro.format.html
@ -154,10 +154,10 @@ macro_rules! println {
/// Macro for printing to the standard error. /// Macro for printing to the standard error.
/// ///
/// Equivalent to the [`print!`] macro, except that output goes to /// 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. /// 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. /// instead for the primary output of your program.
/// ///
/// [`io::stderr`]: ../std/io/struct.Stderr.html /// [`io::stderr`]: ../std/io/struct.Stderr.html
@ -182,10 +182,10 @@ macro_rules! eprint {
/// Macro for printing to the standard error, with a newline. /// Macro for printing to the standard error, with a newline.
/// ///
/// Equivalent to the [`println!`] macro, except that output goes to /// 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. /// 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. /// instead for the primary output of your program.
/// ///
/// [`io::stderr`]: ../std/io/struct.Stderr.html /// [`io::stderr`]: ../std/io/struct.Stderr.html
@ -462,16 +462,16 @@ mod builtin {
/// The core macro for formatted string creation & output. /// The core macro for formatted string creation & output.
/// ///
/// This macro functions by taking a formatting string literal containing /// 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 /// 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 /// the [`Display`] trait can be passed to `format_args!`, as can any
/// [`Debug`] implementation be passed to a `{:?}` within the formatting string. /// [`Debug`] implementation be passed to a `{:?}` within the formatting string.
/// ///
/// This macro produces a value of type [`fmt::Arguments`]. This value can be /// This macro produces a value of type [`fmt::Arguments`]. This value can be
/// passed to the macros within [`std::fmt`] for performing useful redirection. /// passed to the macros within [`std::fmt`] for performing useful redirection.
/// All other formatting macros ([`format!`], [`write!`], [`println!`], etc) are /// 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. /// heap allocations.
/// ///
/// You can use the [`fmt::Arguments`] value that `format_args!` returns /// 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 /// If the named environment variable is present at compile time, this will
/// expand into an expression of type `Option<&'static str>` whose value is /// expand into an expression of type `Option<&'static str>` whose value is
/// `Some` of the value of the environment variable. If the environment /// `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. /// [`Option<T>`][option] for more information on this type.
/// ///
/// A compile time error is never emitted when using this macro regardless /// A compile time error is never emitted when using this macro regardless
@ -904,7 +904,7 @@ mod builtin {
/// # Custom Messages /// # Custom Messages
/// ///
/// This macro has a second form, where a custom panic message can /// 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. /// for syntax for this form.
/// ///
/// [`panic!`]: macro.panic.html /// [`panic!`]: macro.panic.html

View File

@ -671,7 +671,7 @@ impl hash::Hash for SocketAddrV6 {
/// [`SocketAddr`] values. /// [`SocketAddr`] values.
/// ///
/// This trait is used for generic address resolution when constructing network /// 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. /// * [`SocketAddr`]: [`to_socket_addrs`] is the identity function.
/// ///

View File

@ -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 /// 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, /// 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()` 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 /// 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]. /// information, see [the nomicon's section on foreign calling conventions][nomicon-abi].
/// ///

View File

@ -343,13 +343,13 @@ impl Condvar {
/// ///
/// Note that the best effort is made to ensure that the time waited is /// 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 /// 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 /// Condition variables normally have a boolean predicate associated with
/// them, and the predicate must always be checked each time this function /// 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 /// typically desirable for the time-out to not exceed some duration in
/// spite of spurious wakes, thus the sleep-duration is decremented by the /// 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 /// to wait until a condition is met with a total time-out regardless
/// of spurious wakes. /// of spurious wakes.
/// ///
@ -413,7 +413,7 @@ impl Condvar {
} }
/// Waits on this condition variable for a notification, timing out after a /// 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. /// return.
/// ///
/// The semantics of this function are equivalent to [`wait_until`] except /// The semantics of this function are equivalent to [`wait_until`] except

View File

@ -789,7 +789,7 @@ impl<T> Sender<T> {
/// where the corresponding receiver has already been deallocated. Note /// where the corresponding receiver has already been deallocated. Note
/// that a return value of [`Err`] means that the data will never be /// 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 /// 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`]. /// hang up immediately after this function returns [`Ok`].
/// ///
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err /// [`Err`]: ../../../std/result/enum.Result.html#variant.Err

View File

@ -72,11 +72,11 @@ struct SelectInner {
impl !marker::Send for Select {} impl !marker::Send for Select {}
/// A handle to a receiver which is currently a member of a `Select` set of /// 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. /// interact with the underlying receiver.
pub struct Handle<'rx, T:Send+'rx> { pub struct Handle<'rx, T:Send+'rx> {
/// The ID of this handle, used to compare against the return value of /// The ID of this handle, used to compare against the return value of
/// `Select::wait()` /// `Select::wait()`.
id: usize, id: usize,
selector: *mut SelectInner, selector: *mut SelectInner,
next: *mut Handle<'static, ()>, next: *mut Handle<'static, ()>,

View File

@ -314,7 +314,7 @@ impl<T: ?Sized> RwLock<T> {
/// Determines whether the lock is poisoned. /// Determines whether the lock is poisoned.
/// ///
/// If another thread is active, the lock can still become poisoned at any /// 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. /// without additional synchronization.
/// ///
/// # Examples /// # Examples

View File

@ -287,9 +287,9 @@ impl FileTypeExt for fs::FileType {
/// # Note /// # Note
/// ///
/// On Windows, you must specify whether a symbolic link points to a file /// 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 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 /// `SeCreateSymbolicLinkPrivilege` in order to be able to create a
/// symbolic link. /// symbolic link.
/// ///

View File

@ -805,9 +805,9 @@ impl DirEntryExt for fs::DirEntry {
/// # Note /// # Note
/// ///
/// On Windows, you must specify whether a symbolic link points to a file /// 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 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 /// `SeCreateSymbolicLinkPrivilege` in order to be able to create a
/// symbolic link. /// symbolic link.
/// ///

View File

@ -3,19 +3,19 @@
//! # Overview //! # Overview
//! //!
//! For historical reasons, the Windows API uses a form of potentially //! 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 //! 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 //! Unicode standard requires that surrogate code points (those in the
//! range U+D800 to U+DFFF) always be *paired*, because in the UTF-16 //! 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 //! 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. //! these pairings, Windows does not enforce them, either.
//! //!
//! While it is not always possible to convert such a string losslessly into //! 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 //! 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 //! 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 //! Windows APIs together, just passing `WCHAR` strings among those
//! APIs without ever really looking into the strings. //! APIs without ever really looking into the strings.
//! //!
@ -28,16 +28,16 @@
//! # `OsStringExt` and `OsStrExt` //! # `OsStringExt` and `OsStrExt`
//! //!
//! [`OsString`] is the Rust wrapper for owned strings in the //! [`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 //! 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 //! lets you create an [`OsString`] from a `&[u16]` slice; presumably
//! you get such a slice out of a `WCHAR` Windows API. //! you get such a slice out of a `WCHAR` Windows API.
//! //!
//! Similarly, [`OsStr`] is the Rust wrapper for borrowed strings from //! 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 //! [`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 //! 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. //! pointer to this vector's contents and feed it to Windows APIs.
//! //!

View File

@ -841,7 +841,7 @@ const NOTIFIED: usize = 2;
/// let flag2 = Arc::clone(&flag); /// let flag2 = Arc::clone(&flag);
/// ///
/// let parked_thread = thread::spawn(move || { /// 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. /// // park/unpark is more efficient.
/// while !flag2.load(Ordering::Acquire) { /// while !flag2.load(Ordering::Acquire) {
/// println!("Parking thread"); /// println!("Parking thread");

View File

@ -33,7 +33,7 @@ pub use core::time::{SECOND, MILLISECOND, MICROSECOND, NANOSECOND};
/// instant when created, and are often useful for tasks such as measuring /// instant when created, and are often useful for tasks such as measuring
/// benchmarks or timing how long an operation takes. /// 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. /// 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 /// 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 /// experience time dilation (slow down or speed up), but it will never go

View File

@ -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. /// rebuilt.
/// ///
/// You could imagine that, in the future, if the change were /// 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. /// currently must also be rebuilt.
/// ///
/// You could imagine that, in the future, if the change were /// 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. /// signature.
/// ///
/// You could imagine that, in the future, if the change were /// 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 /// 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 /// to `Y`; `X` should not have to be rebuilt, nor should it need to be
/// typechecked again. /// type-checked again.
pub mod call_fn_with_type_in_body { pub mod call_fn_with_type_in_body {
use 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 { pub mod fn_make_struct {
use point::Point; 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 { pub mod fn_read_field {
use point::Point; 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 { pub mod fn_write_field {
use point::Point; use point::Point;

View File

@ -59,8 +59,8 @@ fn make_x() -> P<Expr> {
expr(ExprKind::Path(None, path)) expr(ExprKind::Path(None, path))
} }
/// Iterate over exprs of depth up to `depth`. The goal is to explore all "interesting" /// 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 /// 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`. /// `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>)) { fn iter_exprs(depth: usize, f: &mut FnMut(P<Expr>)) {
if depth == 0 { if depth == 0 {

View File

@ -1,7 +1,7 @@
//! This is a client of the `a` crate defined in "svn-a-base.rs". The //! 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 //! 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 //! 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 //! compiler properly ignores or accepts the change, based on whether
//! the change could affect the downstream crate content or not //! the change could affect the downstream crate content or not
//! (#14132). //! (#14132).

View File

@ -5,7 +5,7 @@
/* /*
# Comparison of static arrays # 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. would be printed, however the below prints false.
*/ */

View File

@ -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 { /*mod test_literals {
#![str = "s"] #![str = "s"]
#![char = 'c'] #![char = 'c']

View File

@ -2,7 +2,7 @@
/*! /*!
* On x86_64-linux-gnu and possibly other platforms, structs get 8-byte "preferred" alignment, * 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 * 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 * 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, * `A` and `B`, even though `S<A>` and `S<B>` have the field `t` at different offsets,

View File

@ -175,7 +175,7 @@ fn test_op_assigns() {
assert_eq!(black_box(tmp), Wrapping($ans)); assert_eq!(black_box(tmp), Wrapping($ans));
} }
// FIXME(30524): Uncomment this test // FIXME(30524): uncomment this test
/* /*
{ {
let mut tmp = Wrapping($initial); let mut tmp = Wrapping($initial);

View File

@ -22,7 +22,7 @@
//! This crate exports a macro `enum_from_primitive!` that wraps an //! This crate exports a macro `enum_from_primitive!` that wraps an
//! `enum` declaration and automatically adds an implementation of //! `enum` declaration and automatically adds an implementation of
//! `num::FromPrimitive` (reexported here), to allow conversion from //! `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 //! alternative to the built-in `#[derive(FromPrimitive)]`, which
//! requires the unstable `std::num::FromPrimitive` and is disabled in //! requires the unstable `std::num::FromPrimitive` and is disabled in
//! Rust 1.0. //! Rust 1.0.

View File

@ -1,4 +1,4 @@
/// Test | Table /// Tests | Table
/// ------|------------- /// ------|-------------
/// t = b | id = \|x\| x /// t = b | id = \|x\| x
pub struct Foo; // @has issue_27862/struct.Foo.html //td 'id = |x| x' pub struct Foo; // @has issue_27862/struct.Foo.html //td 'id = |x| x'

View File

@ -41,7 +41,7 @@ impl ToOwned for u8 {
pub trait ToOwned { pub trait ToOwned {
type Owned; 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; fn to_owned(&self) -> Self::Owned;
} }

View File

@ -17,7 +17,7 @@ impl PathExtensions for PathBuf {}
/// A strategy for acquiring more subpaths to walk. /// A strategy for acquiring more subpaths to walk.
pub trait Strategy { pub trait Strategy {
type P: PathExtensions; 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>>; fn get_more(&self, item: &Self::P) -> io::Result<Vec<Self::P>>;
/// Determine whether a path should be walked further. /// Determine whether a path should be walked further.
/// This is run against each item from `get_more()`. /// This is run against each item from `get_more()`.
@ -44,7 +44,7 @@ pub struct Subpaths<S: Strategy> {
} }
impl<S: Strategy> Subpaths<S> { 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>> { pub fn new(p: &S::P, strategy: S) -> io::Result<Subpaths<S>> {
let stack = strategy.get_more(p)?; let stack = strategy.get_more(p)?;
Ok(Subpaths { stack: stack, strategy: strategy }) Ok(Subpaths { stack: stack, strategy: strategy })
@ -52,7 +52,7 @@ impl<S: Strategy> Subpaths<S> {
} }
impl<S: Default + 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>> { pub fn walk(p: &S::P) -> io::Result<Subpaths<S>> {
Subpaths::new(p, Default::default()) Subpaths::new(p, Default::default())
} }

View File

@ -4,7 +4,7 @@
struct S { struct S {
x: u8, x: u8,
/// The id of the parent core /// The ID of the parent core
y: u8, y: u8,
} }
//~^^^ ERROR found a documentation comment that doesn't document anything //~^^^ ERROR found a documentation comment that doesn't document anything

View File

@ -4,7 +4,7 @@
struct S { struct S {
x: u8 x: u8
/// The id of the parent core /// The ID of the parent core
y: u8, y: u8,
} }
//~^^^ ERROR found a documentation comment that doesn't document anything //~^^^ ERROR found a documentation comment that doesn't document anything

View File

@ -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() { pub fn panics() {
let mut acc = Counter{map: HashMap::new()}; let mut acc = Counter{map: HashMap::new()};
for line in vec!["123456789".to_string(), "12345678".to_string()] { for line in vec!["123456789".to_string(), "12345678".to_string()] {

View File

@ -18,7 +18,7 @@ pub trait NodeCodec<H: Hasher> {
} }
pub trait Trie<H: Hasher, C: NodeCodec<H>> { 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; fn root(&self) -> &H::Out;
/// Is the trie empty? /// Is the trie empty?

View File

@ -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}`"] #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
trait MyFromIterator<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; fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
} }

View File

@ -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}`"] #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
trait MyFromIterator<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; fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
} }

View File

@ -1,7 +1,7 @@
//! This is a client of the `a` crate defined in "svn-a-base.rs". The //! 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 //! 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 //! 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 //! compiler properly ignores or accepts the change, based on whether
//! the change could affect the downstream crate content or not //! the change could affect the downstream crate content or not
//! (#14132). //! (#14132).