From b87363e7632b3f20f9b529696ffb5d5d9c3927cd Mon Sep 17 00:00:00 2001 From: Alexander Regueiro Date: Sat, 9 Feb 2019 21:23:30 +0000 Subject: [PATCH] tests: doc comments --- src/liballoc/collections/btree/node.rs | 6 ++-- src/liballoc/collections/vec_deque.rs | 4 +-- src/liballoc/fmt.rs | 6 ++-- src/liballoc/macros.rs | 6 ++-- src/liballoc/vec.rs | 2 +- src/libcore/alloc.rs | 2 +- src/libcore/any.rs | 6 ++-- src/libcore/cell.rs | 8 +++--- src/libcore/cmp.rs | 2 +- src/libcore/convert.rs | 2 +- src/libcore/intrinsics.rs | 12 ++++---- src/libcore/iter/traits/iterator.rs | 10 +++---- src/libcore/macros.rs | 2 +- src/libcore/mem.rs | 4 +-- src/libcore/num/dec2flt/mod.rs | 6 ++-- src/libcore/num/dec2flt/rawfp.rs | 10 +++---- src/libcore/ops/arith.rs | 2 +- src/libcore/ops/try.rs | 2 +- src/libcore/ptr.rs | 16 +++++------ src/libcore/slice/mod.rs | 6 ++-- src/libcore/slice/rotate.rs | 8 +++--- src/libcore/str/mod.rs | 20 ++++++------- src/libcore/time.rs | 2 +- src/libproc_macro/bridge/scoped_cell.rs | 4 +-- src/libproc_macro/diagnostic.rs | 8 +++--- src/libproc_macro/lib.rs | 12 ++++---- src/libstd/f64.rs | 2 +- src/libstd/ffi/os_str.rs | 2 +- src/libstd/fs.rs | 4 +-- src/libstd/io/buffered.rs | 8 +++--- src/libstd/keyword_docs.rs | 2 +- src/libstd/macros.rs | 28 +++++++++---------- src/libstd/net/addr.rs | 2 +- src/libstd/primitive_docs.rs | 2 +- src/libstd/sync/condvar.rs | 8 +++--- src/libstd/sync/mpsc/mod.rs | 2 +- src/libstd/sync/mpsc/select.rs | 4 +-- src/libstd/sync/rwlock.rs | 2 +- src/libstd/sys/redox/ext/fs.rs | 4 +-- src/libstd/sys/unix/ext/fs.rs | 4 +-- src/libstd/sys/windows/ext/ffi.rs | 16 +++++------ src/libstd/thread/mod.rs | 2 +- src/libstd/time.rs | 2 +- .../change_add_field/struct_point.rs | 18 ++++++------ .../pprust-expr-roundtrip.rs | 4 +-- src/test/run-pass/auxiliary/svh-b.rs | 6 ++-- src/test/run-pass/issues/issue-7012.rs | 2 +- src/test/run-pass/item-attributes.rs | 2 +- .../run-pass/monomorphize-abi-alignment.rs | 2 +- .../numbers-arithmetic/num-wrapping.rs | 2 +- src/test/rustdoc/auxiliary/enum_primitive.rs | 2 +- src/test/rustdoc/issue-27862.rs | 2 +- .../associated-types-coherence-failure.rs | 2 +- src/test/ui/issues/issue-20797.rs | 6 ++-- src/test/ui/issues/issue-48636.fixed | 2 +- src/test/ui/issues/issue-48636.rs | 2 +- .../issue-52126-assign-op-invariance.rs | 2 +- .../ui/nll/user-annotations/issue-55241.rs | 2 +- .../ui/on-unimplemented/bad-annotation.rs | 2 +- src/test/ui/on-unimplemented/on-trait.rs | 2 +- src/test/ui/svh/auxiliary/svh-b.rs | 6 ++-- 61 files changed, 164 insertions(+), 164 deletions(-) diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs index c4f39430533dc..481ee7cebc4e8 100644 --- a/src/liballoc/collections/btree/node.rs +++ b/src/liballoc/collections/btree/node.rs @@ -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 { diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index 99fa54acb0836..a292bde33152a 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -1922,7 +1922,7 @@ impl VecDeque { /// /// # Panics /// - /// If `mid` is greater than `len()`. Note that `mid == len()` + /// If `mid` is greater than `len()`. Note that `mid == len()` /// does _not_ panic and is a no-op rotation. /// /// # Complexity @@ -1967,7 +1967,7 @@ impl VecDeque { /// /// # 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 diff --git a/src/liballoc/fmt.rs b/src/liballoc/fmt.rs index 9bda7034a621b..d2ba9b001916c 100644 --- a/src/liballoc/fmt.rs +++ b/src/liballoc/fmt.rs @@ -27,7 +27,7 @@ //! will then parse the format string and determine if the list of arguments //! provided is suitable to pass to this format string. //! -//! To convert a single value to a string, use the [`to_string`] method. This +//! To convert a single value to a string, use the [`to_string`] method. This //! will use the [`Display`] formatting trait. //! //! ## Positional parameters @@ -102,7 +102,7 @@ //! When requesting that an argument be formatted with a particular type, you //! are actually requesting that an argument ascribes to a particular trait. //! This allows multiple actual types to be formatted via `{:x}` (like [`i8`] as -//! well as [`isize`]). The current mapping of types to traits is: +//! well as [`isize`]). The current mapping of types to traits is: //! //! * *nothing* ⇒ [`Display`] //! * `?` ⇒ [`Debug`] @@ -427,7 +427,7 @@ //! 3. An asterisk `.*`: //! //! `.*` means that this `{...}` is associated with *two* format inputs rather than one: the -//! first input holds the `usize` precision, and the second holds the value to print. Note that +//! first input holds the `usize` precision, and the second holds the value to print. Note that //! in this case, if one uses the format string `{:.*}`, then the `` part refers //! to the *value* to print, and the `precision` must come in the input preceding ``. //! diff --git a/src/liballoc/macros.rs b/src/liballoc/macros.rs index db91b07fa71b4..4fe6d450add08 100644 --- a/src/liballoc/macros.rs +++ b/src/liballoc/macros.rs @@ -62,8 +62,8 @@ macro_rules! vec { /// Creates a `String` using interpolation of runtime expressions. /// -/// The first argument `format!` receives is a format string. This must be a string -/// literal. The power of the formatting string is in the `{}`s contained. +/// The first argument `format!` receives is a format string. This must be a string +/// literal. The power of the formatting string is in the `{}`s contained. /// /// Additional parameters passed to `format!` replace the `{}`s within the /// formatting string in the order given unless named or positional parameters @@ -73,7 +73,7 @@ macro_rules! vec { /// The same convention is used with [`print!`] and [`write!`] macros, /// depending on the intended destination of the string. /// -/// To convert a single value to a string, use the [`to_string`] method. This +/// To convert a single value to a string, use the [`to_string`] method. This /// will use the [`Display`] formatting trait. /// /// [fmt]: ../std/fmt/index.html diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 57e10498b92db..4bc21ec7f5e85 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -738,7 +738,7 @@ impl Vec { /// 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`]. /// diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index 66a3094d77d01..f49e226a5cb68 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -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. /// diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 2afd9e0c07237..01ab523a4c3f6 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -18,7 +18,7 @@ //! //! Consider a situation where we want to log out a value passed to a function. //! We know the value we're working on implements Debug, but we don't know its -//! concrete type. We want to give special treatment to certain types: in this +//! concrete type. We want to give special treatment to certain types: in this //! case printing out the length of String values prior to their value. //! We don't know the concrete type of our value at compile time, so we need to //! use runtime reflection instead. @@ -31,8 +31,8 @@ //! fn log(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::() { //! Some(as_string) => { diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index d57ca13a334e8..fb8d7e5d08864 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -1133,7 +1133,7 @@ impl<'b, T: ?Sized> Ref<'b, T> { /// The `RefCell` is already immutably borrowed, so this cannot fail. /// /// This is an associated function that needs to be used as - /// `Ref::clone(...)`. A `Clone` implementation or a method would interfere + /// `Ref::clone(...)`. A `Clone` implementation or a method would interfere /// with the widespread use of `r.borrow().clone()` to clone the contents of /// a `RefCell`. #[stable(feature = "cell_extras", since = "1.15.0")] @@ -1174,7 +1174,7 @@ impl<'b, T: ?Sized> Ref<'b, T> { } } - /// Split a `Ref` into multiple `Ref`s for different components of the + /// Splits a `Ref` into multiple `Ref`s for different components of the /// borrowed data. /// /// The `RefCell` is already immutably borrowed, so this cannot fail. @@ -1223,7 +1223,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> { /// The `RefCell` is already mutably borrowed, so this cannot fail. /// /// This is an associated function that needs to be used as - /// `RefMut::map(...)`. A method would interfere with methods of the same + /// `RefMut::map(...)`. A method would interfere with methods of the same /// name on the contents of a `RefCell` used through `Deref`. /// /// # Examples @@ -1253,7 +1253,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> { } } - /// Split a `RefMut` into multiple `RefMut`s for different components of the + /// Splits a `RefMut` into multiple `RefMut`s for different components of the /// borrowed data. /// /// The underlying `RefCell` will remain mutably borrowed until both diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index d43a5c1032ce0..81fcdeee12d29 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -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`): diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 203be541e492f..de34e79f597e2 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -217,7 +217,7 @@ pub trait AsMut { /// /// 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 diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index e927ed40d7fb7..c29358c4c4a36 100644 --- a/src/libcore/intrinsics.rs +++ b/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 //! @@ -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; @@ -988,7 +988,7 @@ extern "rust-intrinsic" { /// beginning at `dst` with the same size. /// /// Like [`read`], `copy_nonoverlapping` creates a bitwise copy of `T`, regardless of - /// whether `T` is [`Copy`]. If `T` is not [`Copy`], using *both* the values + /// whether `T` is [`Copy`]. If `T` is not [`Copy`], using *both* the values /// in the region beginning at `*src` and the region beginning at `*dst` can /// [violate memory safety][read-ownership]. /// @@ -1055,7 +1055,7 @@ extern "rust-intrinsic" { /// [`copy_nonoverlapping`] can be used instead. /// /// `copy` is semantically equivalent to C's [`memmove`], but with the argument - /// order swapped. Copying takes place as if the bytes were copied from `src` + /// order swapped. Copying takes place as if the bytes were copied from `src` /// to a temporary array and then copied from the array to `dst`. /// /// [`copy_nonoverlapping`]: ./fn.copy_nonoverlapping.html @@ -1072,7 +1072,7 @@ extern "rust-intrinsic" { /// * Both `src` and `dst` must be properly aligned. /// /// Like [`read`], `copy` creates a bitwise copy of `T`, regardless of - /// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the values + /// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the values /// in the region beginning at `*src` and the region beginning at `*dst` can /// [violate memory safety][read-ownership]. /// diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index 218c7199f35a6..1c86745d9ba40 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -564,9 +564,9 @@ pub trait Iterator { /// Calls a closure on each element of an iterator. /// /// This is equivalent to using a [`for`] loop on the iterator, although - /// `break` and `continue` are not possible from a closure. It's generally + /// `break` and `continue` are not possible from a closure. It's generally /// more idiomatic to use a `for` loop, but `for_each` may be more legible - /// when processing items at the end of longer iterator chains. In some + /// when processing items at the end of longer iterator chains. In some /// cases `for_each` may also be faster than a loop, because it will use /// internal iteration on adaptors like `Chain`. /// @@ -1515,7 +1515,7 @@ pub trait Iterator { /// is propagated back to the caller immediately (short-circuiting). /// /// The initial value is the value the accumulator will have on the first - /// call. If applying the closure succeeded against every element of the + /// call. If applying the closure succeeded against every element of the /// iterator, `try_fold()` returns the final accumulator as success. /// /// Folding is useful whenever you have a collection of something, and want @@ -1528,10 +1528,10 @@ pub trait Iterator { /// do something better than the default `for` loop implementation. /// /// In particular, try to have this call `try_fold()` on the internal parts - /// from which this iterator is composed. If multiple calls are needed, + /// from which this iterator is composed. If multiple calls are needed, /// the `?` operator may be convenient for chaining the accumulator value /// along, but beware any invariants that need to be upheld before those - /// early returns. This is a `&mut self` method, so iteration needs to be + /// early returns. This is a `&mut self` method, so iteration needs to be /// resumable after hitting an error here. /// /// # Examples diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 664490c1997ef..d81d309a81a59 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -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. /// diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 2f86e13b93816..855b8ba7f9646 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1101,7 +1101,7 @@ impl MaybeUninit { } /// 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::zeroed()` is initialized, /// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not /// be null. @@ -1130,7 +1130,7 @@ impl MaybeUninit { } } - /// 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. /// diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index 14a912872be35..a1bf6f824f677 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -37,7 +37,7 @@ //! //! In addition, there are numerous helper functions that are used in the paper but not available //! in Rust (or at least in core). Our version is additionally complicated by the need to handle -//! overflow and underflow and the desire to handle subnormal numbers. Bellerophon and +//! overflow and underflow and the desire to handle subnormal numbers. Bellerophon and //! Algorithm R have trouble with overflow, subnormals, and underflow. We conservatively switch to //! Algorithm M (with the modifications described in section 8 of the paper) well before the //! inputs get into the critical region. @@ -148,7 +148,7 @@ macro_rules! from_str_float_impl { /// # Return value /// /// `Err(ParseFloatError)` if the string did not represent a valid - /// number. Otherwise, `Ok(n)` where `n` is the floating-point + /// number. Otherwise, `Ok(n)` where `n` is the floating-point /// number represented by `src`. #[inline] fn from_str(src: &str) -> Result { @@ -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..]), diff --git a/src/libcore/num/dec2flt/rawfp.rs b/src/libcore/num/dec2flt/rawfp.rs index 6976bd1a0eefd..06d7fb8d1035b 100644 --- a/src/libcore/num/dec2flt/rawfp.rs +++ b/src/libcore/num/dec2flt/rawfp.rs @@ -59,10 +59,10 @@ pub trait RawFloat /// Type used by `to_bits` and `from_bits`. type Bits: Add + From + TryFrom; - /// Raw transmutation to integer. + /// Performs a raw transmutation to an integer. fn to_bits(self) -> Self::Bits; - /// Raw transmutation from integer. + /// Performs a raw transmutation from an integer. fn from_bits(v: Self::Bits) -> Self; /// Returns the category that this number falls into. @@ -71,14 +71,14 @@ pub trait RawFloat /// Returns the mantissa, exponent and sign as integers. fn integer_decode(self) -> (u64, i16, i8); - /// Decode the float. + /// Decodes the float. fn unpack(self) -> Unpacked; - /// Cast from a small integer that can be represented exactly. Panic if the integer can't be + /// Casts from a small integer that can be represented exactly. Panic if the integer can't be /// represented, the other code in this module makes sure to never let that happen. fn from_int(x: u64) -> Self; - /// Get the value 10e from a pre-computed table. + /// Gets the value 10e from a pre-computed table. /// Panics for `e >= CEIL_LOG5_OF_MAX_SIG`. fn short_fast_pow10(e: usize) -> Self; diff --git a/src/libcore/ops/arith.rs b/src/libcore/ops/arith.rs index 7d8bf18d33a01..202beddfcb0b2 100644 --- a/src/libcore/ops/arith.rs +++ b/src/libcore/ops/arith.rs @@ -518,7 +518,7 @@ pub trait Rem { 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 { diff --git a/src/libcore/ops/try.rs b/src/libcore/ops/try.rs index 380bd12131cf6..9fa2c81954ee1 100644 --- a/src/libcore/ops/try.rs +++ b/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")] diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 537aa92c2cf4e..209608457180b 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -12,7 +12,7 @@ //! to access only a single value, in which case the documentation omits the size //! and implicitly assumes it to be `size_of::()` bytes. //! -//! The precise rules for validity are not determined yet. The guarantees that are +//! The precise rules for validity are not determined yet. The guarantees that are //! provided at this point are very minimal: //! //! * A [null] pointer is *never* valid, not even for accesses of [size zero][zst]. @@ -104,7 +104,7 @@ pub use intrinsics::write_bytes; /// /// * `to_drop` must be [valid] for reads. /// -/// * `to_drop` must be properly aligned. See the example below for how to drop +/// * `to_drop` must be properly aligned. See the example below for how to drop /// an unaligned pointer. /// /// Additionally, if `T` is not [`Copy`], using the pointed-to value after @@ -135,7 +135,7 @@ pub use intrinsics::write_bytes; /// unsafe { /// // Get a raw pointer to the last element in `v`. /// let ptr = &mut v[1] as *mut _; -/// // Shorten `v` to prevent the last item from being dropped. We do that first, +/// // Shorten `v` to prevent the last item from being dropped. We do that first, /// // to prevent issues if the `drop_in_place` below panics. /// v.set_len(1); /// // Without a call `drop_in_place`, the last item would never be dropped, @@ -531,7 +531,7 @@ pub unsafe fn replace(dst: *mut T, mut src: T) -> T { /// /// `read` creates a bitwise copy of `T`, regardless of whether `T` is [`Copy`]. /// If `T` is not [`Copy`], using both the returned value and the value at -/// `*src` can violate memory safety. Note that assigning to `*src` counts as a +/// `*src` can violate memory safety. Note that assigning to `*src` counts as a /// use because it will attempt to drop the value at `*src`. /// /// [`write`] can be used to overwrite data without causing it to be dropped. @@ -588,7 +588,7 @@ pub unsafe fn read(src: *const T) -> T { /// * `src` must be [valid] for reads. /// /// Like [`read`], `read_unaligned` creates a bitwise copy of `T`, regardless of -/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned +/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned /// value and the value at `*src` can [violate memory safety][read-ownership]. /// /// Note that even if `T` has size `0`, the pointer must be non-NULL. @@ -839,7 +839,7 @@ pub unsafe fn write_unaligned(dst: *mut T, src: T) { /// * `src` must be properly aligned. /// /// Like [`read`], `read_unaligned` creates a bitwise copy of `T`, regardless of -/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned +/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned /// value and the value at `*src` can [violate memory safety][read-ownership]. /// However, storing non-[`Copy`] types in volatile memory is almost certainly /// incorrect. @@ -1093,7 +1093,7 @@ impl *const T { /// unless `x` and `y` point into the same allocated object. /// /// Always use `.offset(count)` instead when possible, because `offset` - /// allows the compiler to optimize better. If you need to cross object + /// allows the compiler to optimize better. If you need to cross object /// boundaries, cast the pointer to an integer and do the arithmetic there. /// /// # Examples @@ -1712,7 +1712,7 @@ impl *mut T { /// unless `x` and `y` point into the same allocated object. /// /// Always use `.offset(count)` instead when possible, because `offset` - /// allows the compiler to optimize better. If you need to cross object + /// allows the compiler to optimize better. If you need to cross object /// boundaries, cast the pointer to an integer and do the arithmetic there. /// /// # Examples diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index d062da0c247ad..e2129c68e7fbb 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -1197,7 +1197,7 @@ impl [T] { /// Returns an iterator over subslices separated by elements that match /// `pred` limited to returning at most `n` items. This starts at the end of - /// the slice and works backwards. The matched element is not contained in + /// the slice and works backwards. The matched element is not contained in /// the subslices. /// /// The last element returned, if any, will contain the remainder of the @@ -3145,7 +3145,7 @@ unsafe impl Sync for Iter<'_, T> {} unsafe impl Send for Iter<'_, T> {} impl<'a, T> Iter<'a, T> { - /// View the underlying data as a subslice of the original data. + /// Views the underlying data as a subslice of the original data. /// /// This has the same lifetime as the original slice, and so the /// iterator can continue to be used while this exists. @@ -3247,7 +3247,7 @@ unsafe impl Sync for IterMut<'_, T> {} unsafe impl Send for IterMut<'_, T> {} impl<'a, T> IterMut<'a, T> { - /// View the underlying data as a subslice of the original data. + /// Views the underlying data as a subslice of the original data. /// /// To avoid creating `&mut` references that alias, this is forced /// to consume the iterator. diff --git a/src/libcore/slice/rotate.rs b/src/libcore/slice/rotate.rs index 52677713f5ac4..9b35b51349a02 100644 --- a/src/libcore/slice/rotate.rs +++ b/src/libcore/slice/rotate.rs @@ -26,7 +26,7 @@ impl RawArray { } /// Rotates the range `[mid-left, mid+right)` such that the element at `mid` -/// becomes the first element. Equivalently, rotates the range `left` +/// becomes the first element. Equivalently, rotates the range `left` /// elements to the left or `right` elements to the right. /// /// # Safety @@ -36,10 +36,10 @@ impl RawArray { /// # Algorithm /// /// For longer rotations, swap the left-most `delta = min(left, right)` -/// elements with the right-most `delta` elements. LLVM vectorizes this, +/// elements with the right-most `delta` elements. LLVM vectorizes this, /// which is profitable as we only reach this step for a "large enough" -/// rotation. Doing this puts `delta` elements on the larger side into the -/// correct position, leaving a smaller rotate problem. Demonstration: +/// rotation. Doing this puts `delta` elements on the larger side into the +/// correct position, leaving a smaller rotate problem. Demonstration: /// /// ```text /// [ 6 7 8 9 10 11 12 13 . 1 2 3 4 5 ] diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 81c351be30502..c43db91688829 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -612,7 +612,7 @@ impl<'a> DoubleEndedIterator for Chars<'a> { impl FusedIterator for Chars<'_> {} impl<'a> Chars<'a> { - /// View the underlying data as a subslice of the original data. + /// Views the underlying data as a subslice of the original data. /// /// This has the same lifetime as the original slice, and so the /// iterator can continue to be used while this exists. @@ -702,7 +702,7 @@ impl<'a> DoubleEndedIterator for CharIndices<'a> { impl FusedIterator for CharIndices<'_> {} impl<'a> CharIndices<'a> { - /// View the underlying data as a subslice of the original data. + /// Views the underlying data as a subslice of the original data. /// /// This has the same lifetime as the original slice, and so the /// iterator can continue to be used while this exists. @@ -1579,9 +1579,9 @@ mod traits { /// Implements ordering of strings. /// - /// Strings are ordered lexicographically by their byte values. This orders Unicode code - /// points based on their positions in the code charts. This is not necessarily the same as - /// "alphabetical" order, which varies by language and locale. Sorting strings according to + /// Strings are ordered lexicographically by their byte values. This orders Unicode code + /// points based on their positions in the code charts. This is not necessarily the same as + /// "alphabetical" order, which varies by language and locale. Sorting strings according to /// culturally-accepted standards requires locale-specific data that is outside the scope of /// the `str` type. #[stable(feature = "rust1", since = "1.0.0")] @@ -1607,9 +1607,9 @@ mod traits { /// Implements comparison operations on strings. /// - /// Strings are compared lexicographically by their byte values. This compares Unicode code - /// points based on their positions in the code charts. This is not necessarily the same as - /// "alphabetical" order, which varies by language and locale. Comparing strings according to + /// Strings are compared lexicographically by their byte values. This compares Unicode code + /// points based on their positions in the code charts. This is not necessarily the same as + /// "alphabetical" order, which varies by language and locale. Comparing strings according to /// culturally-accepted standards requires locale-specific data that is outside the scope of /// the `str` type. #[stable(feature = "rust1", since = "1.0.0")] @@ -2643,7 +2643,7 @@ impl str { Bytes(self.as_bytes().iter().cloned()) } - /// Split a string slice by whitespace. + /// Splits a string slice by whitespace. /// /// The iterator returned will return string slices that are sub-slices of /// the original string slice, separated by any amount of whitespace. @@ -2686,7 +2686,7 @@ impl str { SplitWhitespace { inner: self.split(IsWhitespace).filter(IsNotEmpty) } } - /// Split a string slice by ASCII whitespace. + /// Splits a string slice by ASCII whitespace. /// /// The iterator returned will return string slices that are sub-slices of /// the original string slice, separated by any amount of ASCII whitespace. diff --git a/src/libcore/time.rs b/src/libcore/time.rs index a751965dffab3..ee583c829dd1d 100644 --- a/src/libcore/time.rs +++ b/src/libcore/time.rs @@ -43,7 +43,7 @@ pub const NANOSECOND: Duration = Duration::from_nanos(1); /// timeouts. /// /// Each `Duration` is composed of a whole number of seconds and a fractional part -/// represented in nanoseconds. If the underlying system does not support +/// represented in nanoseconds. If the underlying system does not support /// nanosecond-level precision, APIs binding a system timeout will typically round up /// the number of nanoseconds. /// diff --git a/src/libproc_macro/bridge/scoped_cell.rs b/src/libproc_macro/bridge/scoped_cell.rs index b1ab27c153e06..6f7965095b638 100644 --- a/src/libproc_macro/bridge/scoped_cell.rs +++ b/src/libproc_macro/bridge/scoped_cell.rs @@ -38,7 +38,7 @@ impl ScopedCell { ScopedCell(Cell::new(value)) } - /// Set the value in `self` to `replacement` while + /// Sets the value in `self` to `replacement` while /// running `f`, which gets the old value, mutably. /// The old value will be restored after `f` exits, even /// by panic, including modifications made to it by `f`. @@ -73,7 +73,7 @@ impl ScopedCell { 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: >::Out, f: impl FnOnce() -> R) -> R { self.replace(value, |_| f()) } diff --git a/src/libproc_macro/diagnostic.rs b/src/libproc_macro/diagnostic.rs index 7a0c9419f6234..65eebb5ec3737 100644 --- a/src/libproc_macro/diagnostic.rs +++ b/src/libproc_macro/diagnostic.rs @@ -56,7 +56,7 @@ pub struct Diagnostic { macro_rules! diagnostic_child_methods { ($spanned:ident, $regular:ident, $level:expr) => ( - /// Add a new child diagnostic message to `self` with the level + /// Adds a new child diagnostic message to `self` with the level /// identified by this method's name with the given `spans` and /// `message`. #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] @@ -67,7 +67,7 @@ macro_rules! diagnostic_child_methods { self } - /// Add a new child diagnostic message to `self` with the level + /// Adds a new child diagnostic message to `self` with the level /// identified by this method's name with the given `message`. #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] pub fn $regular>(mut self, message: T) -> Diagnostic { @@ -93,7 +93,7 @@ impl<'a> Iterator for Children<'a> { #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] impl Diagnostic { - /// Create a new diagnostic with the given `level` and `message`. + /// Creates a new diagnostic with the given `level` and `message`. #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] pub fn new>(level: Level, message: T) -> Diagnostic { Diagnostic { @@ -104,7 +104,7 @@ impl Diagnostic { } } - /// Create a new diagnostic with the given `level` and `message` pointing to + /// Creates a new diagnostic with the given `level` and `message` pointing to /// the given set of `spans`. #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] pub fn spanned(spans: S, level: Level, message: T) -> Diagnostic diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index 2cdc5a48a5316..bd0a7ec0e1a9d 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -88,7 +88,7 @@ impl TokenStream { /// or characters not existing in the language. /// All tokens in the parsed stream get `Span::call_site()` spans. /// -/// NOTE: Some errors may cause panics instead of returning `LexError`. We reserve the right to +/// NOTE: some errors may cause panics instead of returning `LexError`. We reserve the right to /// change these errors into `LexError`s later. #[stable(feature = "proc_macro_lib", since = "1.15.0")] impl FromStr for TokenStream { @@ -244,7 +244,7 @@ impl !Sync for Span {} macro_rules! diagnostic_method { ($name:ident, $level:expr) => ( - /// Create a new `Diagnostic` with the given `message` at the span + /// Creates a new `Diagnostic` with the given `message` at the span /// `self`. #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] pub fn $name>(self, message: T) -> Diagnostic { @@ -290,19 +290,19 @@ impl Span { Span(self.0.source()) } - /// Get the starting line/column in the source file for this span. + /// Gets the starting line/column in the source file for this span. #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn start(&self) -> LineColumn { self.0.start() } - /// Get the ending line/column in the source file for this span. + /// Gets the ending line/column in the source file for this span. #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn end(&self) -> LineColumn { self.0.end() } - /// Create a new span encompassing `self` and `other`. + /// Creates a new span encompassing `self` and `other`. /// /// Returns `None` if `self` and `other` are from different files. #[unstable(feature = "proc_macro_span", issue = "54725")] @@ -368,7 +368,7 @@ impl !Sync for LineColumn {} pub struct SourceFile(bridge::client::SourceFile); impl SourceFile { - /// Get the path to this source file. + /// Gets the path to this source file. /// /// ### Note /// If the code span associated with this `SourceFile` was generated by an external macro, this diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 2e0383ccef58e..7fa7b80751938 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -250,7 +250,7 @@ impl f64 { /// Calculates the least nonnegative remainder of `self (mod rhs)`. /// /// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in - /// most cases. However, due to a floating point round-off error it can + /// most cases. However, due to a floating point round-off error it can /// result in `r == rhs.abs()`, violating the mathematical definition, if /// `self` is much smaller than `rhs.abs()` in magnitude and `self < 0.0`. /// This result is not an element of the function's codomain, but it is the diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index f817689251324..c05c19ae56663 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -24,7 +24,7 @@ use sys_common::{AsInner, IntoInner, FromInner}; /// /// `OsString` and [`OsStr`] bridge this gap by simultaneously representing Rust /// and platform-native string values, and in particular allowing a Rust string -/// to be converted into an "OS" string with no cost if possible. A consequence +/// to be converted into an "OS" string with no cost if possible. A consequence /// of this is that `OsString` instances are *not* `NUL` terminated; in order /// to pass to e.g., Unix system call, you should create a [`CStr`]. /// diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 3538816c1124c..2837aade82cd2 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -222,7 +222,7 @@ fn initial_buffer_size(file: &File) -> usize { /// Read the entire contents of a file into a bytes vector. /// /// This is a convenience function for using [`File::open`] and [`read_to_end`] -/// with fewer imports and without an intermediate variable. It pre-allocates a +/// with fewer imports and without an intermediate variable. It pre-allocates a /// buffer based on the file size when available, so it is generally faster than /// reading into a vector created with `Vec::new()`. /// @@ -263,7 +263,7 @@ pub fn read>(path: P) -> io::Result> { /// Read the entire contents of a file into a string. /// /// This is a convenience function for using [`File::open`] and [`read_to_string`] -/// with fewer imports and without an intermediate variable. It pre-allocates a +/// with fewer imports and without an intermediate variable. It pre-allocates a /// buffer based on the file size when available, so it is generally faster than /// reading into a string created with `String::new()`. /// diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 056aa7c0c4263..0615cd59db4eb 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -16,9 +16,9 @@ use memchr; /// the underlying [`Read`] and maintains an in-memory buffer of the results. /// /// `BufReader` can improve the speed of programs that make *small* and -/// *repeated* read calls to the same file or network socket. It does not +/// *repeated* read calls to the same file or network socket. It does not /// help when reading very large amounts at once, or reading just one or a few -/// times. It also provides no advantage when reading from a source that is +/// times. It also provides no advantage when reading from a source that is /// already in memory, like a `Vec`. /// /// [`Read`]: ../../std/io/trait.Read.html @@ -331,9 +331,9 @@ impl Seek for BufReader { /// writer in large, infrequent batches. /// /// `BufWriter` can improve the speed of programs that make *small* and -/// *repeated* write calls to the same file or network socket. It does not +/// *repeated* write calls to the same file or network socket. It does not /// help when writing very large amounts at once, or writing just one or a few -/// times. It also provides no advantage when writing to a destination that is +/// times. It also provides no advantage when writing to a destination that is /// in memory, like a `Vec`. /// /// When the `BufWriter` is dropped, the contents of its buffer will be written diff --git a/src/libstd/keyword_docs.rs b/src/libstd/keyword_docs.rs index a7ecee2d82203..d5c2aaea543f4 100644 --- a/src/libstd/keyword_docs.rs +++ b/src/libstd/keyword_docs.rs @@ -627,7 +627,7 @@ mod loop_keyword { } /// directly accessed and modified. /// /// Tuple structs are similar to regular structs, but its fields have no names. They are used like -/// tuples, with deconstruction possible via `let TupleStruct(x, y) = foo;` syntax. For accessing +/// tuples, with deconstruction possible via `let TupleStruct(x, y) = foo;` syntax. For accessing /// individual variables, the same syntax is used as with regular tuples, namely `foo.0`, `foo.1`, /// etc, starting at zero. /// diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index b87257188df10..2ed3377838be3 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -11,8 +11,8 @@ /// an unrecoverable problem. /// /// This macro is the perfect way to assert conditions in example code and in -/// tests. `panic!` is closely tied with the `unwrap` method of both [`Option`] -/// and [`Result`][runwrap] enums. Both implementations call `panic!` when they are set +/// tests. `panic!` is closely tied with the `unwrap` method of both [`Option`] +/// and [`Result`][runwrap] enums. Both implementations call `panic!` when they are set /// to None or Err variants. /// /// This macro is used to inject panic into a Rust thread, causing the thread to @@ -21,7 +21,7 @@ /// is transmitted. /// /// [`Result`] enum is often a better solution for recovering from errors than -/// using the `panic!` macro. This macro should be used to avoid proceeding using +/// using the `panic!` macro. This macro should be used to avoid proceeding using /// incorrect values, such as from external sources. Detailed information about /// error handling is found in the [book]. /// @@ -79,7 +79,7 @@ macro_rules! panic { /// necessary to use [`io::stdout().flush()`][flush] to ensure the output is emitted /// immediately. /// -/// Use `print!` only for the primary output of your program. Use +/// Use `print!` only for the primary output of your program. Use /// [`eprint!`] instead to print error and progress messages. /// /// [`println!`]: ../std/macro.println.html @@ -124,7 +124,7 @@ macro_rules! print { /// Use the [`format!`] syntax to write data to the standard output. /// See [`std::fmt`] for more information. /// -/// Use `println!` only for the primary output of your program. Use +/// Use `println!` only for the primary output of your program. Use /// [`eprintln!`] instead to print error and progress messages. /// /// [`format!`]: ../std/macro.format.html @@ -154,10 +154,10 @@ macro_rules! println { /// Macro for printing to the standard error. /// /// Equivalent to the [`print!`] macro, except that output goes to -/// [`io::stderr`] instead of `io::stdout`. See [`print!`] for +/// [`io::stderr`] instead of `io::stdout`. See [`print!`] for /// example usage. /// -/// Use `eprint!` only for error and progress messages. Use `print!` +/// Use `eprint!` only for error and progress messages. Use `print!` /// instead for the primary output of your program. /// /// [`io::stderr`]: ../std/io/struct.Stderr.html @@ -182,10 +182,10 @@ macro_rules! eprint { /// Macro for printing to the standard error, with a newline. /// /// Equivalent to the [`println!`] macro, except that output goes to -/// [`io::stderr`] instead of `io::stdout`. See [`println!`] for +/// [`io::stderr`] instead of `io::stdout`. See [`println!`] for /// example usage. /// -/// Use `eprintln!` only for error and progress messages. Use `println!` +/// Use `eprintln!` only for error and progress messages. Use `println!` /// instead for the primary output of your program. /// /// [`io::stderr`]: ../std/io/struct.Stderr.html @@ -462,16 +462,16 @@ mod builtin { /// The core macro for formatted string creation & output. /// /// This macro functions by taking a formatting string literal containing - /// `{}` for each additional argument passed. `format_args!` prepares the + /// `{}` for each additional argument passed. `format_args!` prepares the /// additional parameters to ensure the output can be interpreted as a string - /// and canonicalizes the arguments into a single type. Any value that implements + /// and canonicalizes the arguments into a single type. Any value that implements /// the [`Display`] trait can be passed to `format_args!`, as can any /// [`Debug`] implementation be passed to a `{:?}` within the formatting string. /// /// This macro produces a value of type [`fmt::Arguments`]. This value can be /// passed to the macros within [`std::fmt`] for performing useful redirection. /// All other formatting macros ([`format!`], [`write!`], [`println!`], etc) are - /// proxied through this one. `format_args!`, unlike its derived macros, avoids + /// proxied through this one. `format_args!`, unlike its derived macros, avoids /// heap allocations. /// /// You can use the [`fmt::Arguments`] value that `format_args!` returns @@ -554,7 +554,7 @@ mod builtin { /// If the named environment variable is present at compile time, this will /// expand into an expression of type `Option<&'static str>` whose value is /// `Some` of the value of the environment variable. If the environment - /// variable is not present, then this will expand to `None`. See + /// variable is not present, then this will expand to `None`. See /// [`Option`][option] for more information on this type. /// /// A compile time error is never emitted when using this macro regardless @@ -904,7 +904,7 @@ mod builtin { /// # Custom Messages /// /// This macro has a second form, where a custom panic message can - /// be provided with or without arguments for formatting. See [`std::fmt`] + /// be provided with or without arguments for formatting. See [`std::fmt`] /// for syntax for this form. /// /// [`panic!`]: macro.panic.html diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index 8ace11276586f..91167debff3ba 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -671,7 +671,7 @@ impl hash::Hash for SocketAddrV6 { /// [`SocketAddr`] values. /// /// This trait is used for generic address resolution when constructing network -/// objects. By default it is implemented for the following types: +/// objects. By default it is implemented for the following types: /// /// * [`SocketAddr`]: [`to_socket_addrs`] is the identity function. /// diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs index c2751508ce094..b0c0a8949dbdd 100644 --- a/src/libstd/primitive_docs.rs +++ b/src/libstd/primitive_docs.rs @@ -1062,7 +1062,7 @@ mod prim_ref { } /// On top of that, function pointers can vary based on what ABI they use. This is achieved by /// adding the `extern` keyword to the type name, followed by the ABI in question. For example, /// `fn()` is different from `extern "C" fn()`, which itself is different from `extern "stdcall" -/// fn()`, and so on for the various ABIs that Rust supports. Non-`extern` functions have an ABI +/// fn()`, and so on for the various ABIs that Rust supports. Non-`extern` functions have an ABI /// of `"Rust"`, and `extern` functions without an explicit ABI have an ABI of `"C"`. For more /// information, see [the nomicon's section on foreign calling conventions][nomicon-abi]. /// diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 7688737910676..3b147e059a099 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -343,13 +343,13 @@ impl Condvar { /// /// Note that the best effort is made to ensure that the time waited is /// measured with a monotonic clock, and not affected by the changes made to - /// the system time. This function is susceptible to spurious wakeups. + /// the system time. This function is susceptible to spurious wakeups. /// Condition variables normally have a boolean predicate associated with /// them, and the predicate must always be checked each time this function - /// returns to protect against spurious wakeups. Additionally, it is + /// returns to protect against spurious wakeups. Additionally, it is /// typically desirable for the time-out to not exceed some duration in /// spite of spurious wakes, thus the sleep-duration is decremented by the - /// amount slept. Alternatively, use the `wait_timeout_until` method + /// amount slept. Alternatively, use the `wait_timeout_until` method /// to wait until a condition is met with a total time-out regardless /// of spurious wakes. /// @@ -413,7 +413,7 @@ impl Condvar { } /// Waits on this condition variable for a notification, timing out after a - /// specified duration. Spurious wakes will not cause this function to + /// specified duration. Spurious wakes will not cause this function to /// return. /// /// The semantics of this function are equivalent to [`wait_until`] except diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 446c164965d6f..d1cd76778f4a3 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -789,7 +789,7 @@ impl Sender { /// where the corresponding receiver has already been deallocated. Note /// that a return value of [`Err`] means that the data will never be /// received, but a return value of [`Ok`] does *not* mean that the data - /// will be received. It is possible for the corresponding receiver to + /// will be received. It is possible for the corresponding receiver to /// hang up immediately after this function returns [`Ok`]. /// /// [`Err`]: ../../../std/result/enum.Result.html#variant.Err diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index 8f41680a818b9..472df01fee316 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -72,11 +72,11 @@ struct SelectInner { impl !marker::Send for Select {} /// A handle to a receiver which is currently a member of a `Select` set of -/// receivers. This handle is used to keep the receiver in the set as well as +/// receivers. This handle is used to keep the receiver in the set as well as /// interact with the underlying receiver. pub struct Handle<'rx, T:Send+'rx> { /// The ID of this handle, used to compare against the return value of - /// `Select::wait()` + /// `Select::wait()`. id: usize, selector: *mut SelectInner, next: *mut Handle<'static, ()>, diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 7fbe0b8c19900..2b3bcb97d5929 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -314,7 +314,7 @@ impl RwLock { /// Determines whether the lock is poisoned. /// /// If another thread is active, the lock can still become poisoned at any - /// time. You should not trust a `false` value for program correctness + /// time. You should not trust a `false` value for program correctness /// without additional synchronization. /// /// # Examples diff --git a/src/libstd/sys/redox/ext/fs.rs b/src/libstd/sys/redox/ext/fs.rs index 04edfd6851dde..76fea656d1334 100644 --- a/src/libstd/sys/redox/ext/fs.rs +++ b/src/libstd/sys/redox/ext/fs.rs @@ -287,9 +287,9 @@ impl FileTypeExt for fs::FileType { /// # Note /// /// On Windows, you must specify whether a symbolic link points to a file -/// or directory. Use `os::windows::fs::symlink_file` to create a +/// or directory. Use `os::windows::fs::symlink_file` to create a /// symbolic link to a file, or `os::windows::fs::symlink_dir` to create a -/// symbolic link to a directory. Additionally, the process must have +/// symbolic link to a directory. Additionally, the process must have /// `SeCreateSymbolicLinkPrivilege` in order to be able to create a /// symbolic link. /// diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index e962d09e274e1..afeb756806f49 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -805,9 +805,9 @@ impl DirEntryExt for fs::DirEntry { /// # Note /// /// On Windows, you must specify whether a symbolic link points to a file -/// or directory. Use `os::windows::fs::symlink_file` to create a +/// or directory. Use `os::windows::fs::symlink_file` to create a /// symbolic link to a file, or `os::windows::fs::symlink_dir` to create a -/// symbolic link to a directory. Additionally, the process must have +/// symbolic link to a directory. Additionally, the process must have /// `SeCreateSymbolicLinkPrivilege` in order to be able to create a /// symbolic link. /// diff --git a/src/libstd/sys/windows/ext/ffi.rs b/src/libstd/sys/windows/ext/ffi.rs index eb27891930749..6508c0cf447d1 100644 --- a/src/libstd/sys/windows/ext/ffi.rs +++ b/src/libstd/sys/windows/ext/ffi.rs @@ -3,19 +3,19 @@ //! # Overview //! //! For historical reasons, the Windows API uses a form of potentially -//! ill-formed UTF-16 encoding for strings. Specifically, the 16-bit +//! ill-formed UTF-16 encoding for strings. Specifically, the 16-bit //! code units in Windows strings may contain [isolated surrogate code -//! points which are not paired together][ill-formed-utf-16]. The +//! points which are not paired together][ill-formed-utf-16]. The //! Unicode standard requires that surrogate code points (those in the //! range U+D800 to U+DFFF) always be *paired*, because in the UTF-16 //! encoding a *surrogate code unit pair* is used to encode a single -//! character. For compatibility with code that does not enforce +//! character. For compatibility with code that does not enforce //! these pairings, Windows does not enforce them, either. //! //! While it is not always possible to convert such a string losslessly into //! a valid UTF-16 string (or even UTF-8), it is often desirable to be //! able to round-trip such a string from and to Windows APIs -//! losslessly. For example, some Rust code may be "bridging" some +//! losslessly. For example, some Rust code may be "bridging" some //! Windows APIs together, just passing `WCHAR` strings among those //! APIs without ever really looking into the strings. //! @@ -28,16 +28,16 @@ //! # `OsStringExt` and `OsStrExt` //! //! [`OsString`] is the Rust wrapper for owned strings in the -//! preferred representation of the operating system. On Windows, +//! preferred representation of the operating system. On Windows, //! this struct gets augmented with an implementation of the -//! [`OsStringExt`] trait, which has a [`from_wide`] method. This +//! [`OsStringExt`] trait, which has a [`from_wide`] method. This //! lets you create an [`OsString`] from a `&[u16]` slice; presumably //! you get such a slice out of a `WCHAR` Windows API. //! //! Similarly, [`OsStr`] is the Rust wrapper for borrowed strings from -//! preferred representation of the operating system. On Windows, the +//! preferred representation of the operating system. On Windows, the //! [`OsStrExt`] trait provides the [`encode_wide`] method, which -//! outputs an [`EncodeWide`] iterator. You can [`collect`] this +//! outputs an [`EncodeWide`] iterator. You can [`collect`] this //! iterator, for example, to obtain a `Vec`; you can later get a //! pointer to this vector's contents and feed it to Windows APIs. //! diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index eb8e0c1c8ac66..438ea3aa3f6a3 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -841,7 +841,7 @@ const NOTIFIED: usize = 2; /// let flag2 = Arc::clone(&flag); /// /// let parked_thread = thread::spawn(move || { -/// // We want to wait until the flag is set. We *could* just spin, but using +/// // We want to wait until the flag is set. We *could* just spin, but using /// // park/unpark is more efficient. /// while !flag2.load(Ordering::Acquire) { /// println!("Parking thread"); diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 23924559fcc24..c258e3f1a55fe 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -33,7 +33,7 @@ pub use core::time::{SECOND, MILLISECOND, MICROSECOND, NANOSECOND}; /// instant when created, and are often useful for tasks such as measuring /// benchmarks or timing how long an operation takes. /// -/// Note, however, that instants are not guaranteed to be **steady**. In other +/// Note, however, that instants are not guaranteed to be **steady**. In other /// words, each tick of the underlying clock may not be the same length (e.g. /// some seconds may be longer than others). An instant may jump forwards or /// experience time dilation (slow down or speed up), but it will never go diff --git a/src/test/incremental/change_add_field/struct_point.rs b/src/test/incremental/change_add_field/struct_point.rs index 6006831e48234..182e6cb45be64 100644 --- a/src/test/incremental/change_add_field/struct_point.rs +++ b/src/test/incremental/change_add_field/struct_point.rs @@ -60,7 +60,7 @@ pub mod point { } } -/// A fn that has the changed type in its signature; must currently be +/// A function that has the changed type in its signature; must currently be /// rebuilt. /// /// You could imagine that, in the future, if the change were @@ -76,7 +76,7 @@ pub mod fn_with_type_in_sig { } } -/// Call a fn that has the changed type in its signature; this +/// Call a function that has the changed type in its signature; this /// currently must also be rebuilt. /// /// You could imagine that, in the future, if the change were @@ -92,7 +92,7 @@ pub mod call_fn_with_type_in_sig { } } -/// A fn that uses the changed type, but only in its body, not its +/// A function that uses the changed type, but only in its body, not its /// signature. /// /// You could imagine that, in the future, if the change were @@ -108,10 +108,10 @@ pub mod fn_with_type_in_body { } } -/// A fn X that calls a fn Y, where Y uses the changed type in its +/// A function `X` that calls a function `Y`, where `Y` uses the changed type in its /// body. In this case, the effects of the change should be contained -/// to Y; X should not have to be rebuilt, nor should it need to be -/// typechecked again. +/// to `Y`; `X` should not have to be rebuilt, nor should it need to be +/// type-checked again. pub mod call_fn_with_type_in_body { use fn_with_type_in_body; @@ -121,7 +121,7 @@ pub mod call_fn_with_type_in_body { } } -/// A fn item that makes an instance of `Point` but does not invoke methods +/// A function item that makes an instance of `Point` but does not invoke methods. pub mod fn_make_struct { use point::Point; @@ -131,7 +131,7 @@ pub mod fn_make_struct { } } -/// A fn item that reads fields from `Point` but does not invoke methods +/// A function item that reads fields from `Point` but does not invoke methods. pub mod fn_read_field { use point::Point; @@ -141,7 +141,7 @@ pub mod fn_read_field { } } -/// A fn item that writes to a field of `Point` but does not invoke methods +/// A function item that writes to a field of `Point` but does not invoke methods. pub mod fn_write_field { use point::Point; diff --git a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs index ee4ecde44f28e..956bc5ad862ca 100644 --- a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs @@ -59,8 +59,8 @@ fn make_x() -> P { expr(ExprKind::Path(None, path)) } -/// Iterate over exprs of depth up to `depth`. The goal is to explore all "interesting" -/// combinations of expression nesting. For example, we explore combinations using `if`, but not +/// Iterate over exprs of depth up to `depth`. The goal is to explore all "interesting" +/// combinations of expression nesting. For example, we explore combinations using `if`, but not /// `while` or `match`, since those should print and parse in much the same way as `if`. fn iter_exprs(depth: usize, f: &mut FnMut(P)) { if depth == 0 { diff --git a/src/test/run-pass/auxiliary/svh-b.rs b/src/test/run-pass/auxiliary/svh-b.rs index 03869aeb37194..57029f70888b3 100644 --- a/src/test/run-pass/auxiliary/svh-b.rs +++ b/src/test/run-pass/auxiliary/svh-b.rs @@ -1,7 +1,7 @@ -//! This is a client of the `a` crate defined in "svn-a-base.rs". The -//! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use +//! This is a client of the `a` crate defined in `svn-a-base.rs`. The +//! rpass and cfail tests (such as `run-pass/svh-add-comment.rs`) use //! it by swapping in a different object code library crate built from -//! some variant of "svn-a-base.rs", and then we are checking if the +//! some variant of `svn-a-base.rs`, and then we are checking if the //! compiler properly ignores or accepts the change, based on whether //! the change could affect the downstream crate content or not //! (#14132). diff --git a/src/test/run-pass/issues/issue-7012.rs b/src/test/run-pass/issues/issue-7012.rs index a1c4bf83beb34..90eba1706956d 100644 --- a/src/test/run-pass/issues/issue-7012.rs +++ b/src/test/run-pass/issues/issue-7012.rs @@ -5,7 +5,7 @@ /* # Comparison of static arrays -The expected behaviour would be that test==test1, therefore 'true' +The expected behaviour would be that `test == test1`, therefore 'true' would be printed, however the below prints false. */ diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs index 52b931f638c09..e3ed350f29a94 100644 --- a/src/test/run-pass/item-attributes.rs +++ b/src/test/run-pass/item-attributes.rs @@ -163,7 +163,7 @@ mod test_foreign_items { } -// FIXME #623 - these aren't supported yet +// FIXME(#623): - these aren't supported yet /*mod test_literals { #![str = "s"] #![char = 'c'] diff --git a/src/test/run-pass/monomorphize-abi-alignment.rs b/src/test/run-pass/monomorphize-abi-alignment.rs index b55974e64210a..a26f324f7dc05 100644 --- a/src/test/run-pass/monomorphize-abi-alignment.rs +++ b/src/test/run-pass/monomorphize-abi-alignment.rs @@ -2,7 +2,7 @@ /*! * On x86_64-linux-gnu and possibly other platforms, structs get 8-byte "preferred" alignment, * but their "ABI" alignment (i.e., what actually matters for data layout) is the largest alignment - * of any field. (Also, u64 has 8-byte ABI alignment; this is not always true). + * of any field. (Also, `u64` has 8-byte ABI alignment; this is not always true). * * On such platforms, if monomorphize uses the "preferred" alignment, then it will unify * `A` and `B`, even though `S` and `S` have the field `t` at different offsets, diff --git a/src/test/run-pass/numbers-arithmetic/num-wrapping.rs b/src/test/run-pass/numbers-arithmetic/num-wrapping.rs index d7ab51f8649c3..9a01549ecd24e 100644 --- a/src/test/run-pass/numbers-arithmetic/num-wrapping.rs +++ b/src/test/run-pass/numbers-arithmetic/num-wrapping.rs @@ -175,7 +175,7 @@ fn test_op_assigns() { assert_eq!(black_box(tmp), Wrapping($ans)); } - // FIXME(30524): Uncomment this test + // FIXME(30524): uncomment this test /* { let mut tmp = Wrapping($initial); diff --git a/src/test/rustdoc/auxiliary/enum_primitive.rs b/src/test/rustdoc/auxiliary/enum_primitive.rs index eff47e8d8dde9..ed1da253a9732 100644 --- a/src/test/rustdoc/auxiliary/enum_primitive.rs +++ b/src/test/rustdoc/auxiliary/enum_primitive.rs @@ -22,7 +22,7 @@ //! This crate exports a macro `enum_from_primitive!` that wraps an //! `enum` declaration and automatically adds an implementation of //! `num::FromPrimitive` (reexported here), to allow conversion from -//! primitive integers to the enum. It therefore provides an +//! primitive integers to the enum. It therefore provides an //! alternative to the built-in `#[derive(FromPrimitive)]`, which //! requires the unstable `std::num::FromPrimitive` and is disabled in //! Rust 1.0. diff --git a/src/test/rustdoc/issue-27862.rs b/src/test/rustdoc/issue-27862.rs index ce3978e7e9a8e..77522f1be2307 100644 --- a/src/test/rustdoc/issue-27862.rs +++ b/src/test/rustdoc/issue-27862.rs @@ -1,4 +1,4 @@ -/// Test | Table +/// Tests | Table /// ------|------------- /// t = b | id = \|x\| x pub struct Foo; // @has issue_27862/struct.Foo.html //td 'id = |x| x' diff --git a/src/test/ui/associated-types/associated-types-coherence-failure.rs b/src/test/ui/associated-types/associated-types-coherence-failure.rs index fe1201ea06f18..c33f2ac96ba62 100644 --- a/src/test/ui/associated-types/associated-types-coherence-failure.rs +++ b/src/test/ui/associated-types/associated-types-coherence-failure.rs @@ -41,7 +41,7 @@ impl ToOwned for u8 { pub trait ToOwned { type Owned; - /// Create owned data from borrowed data, usually by copying. + /// Creates owned data from borrowed data, usually by copying. fn to_owned(&self) -> Self::Owned; } diff --git a/src/test/ui/issues/issue-20797.rs b/src/test/ui/issues/issue-20797.rs index ce8564ffe43ad..e504b4705daf2 100644 --- a/src/test/ui/issues/issue-20797.rs +++ b/src/test/ui/issues/issue-20797.rs @@ -17,7 +17,7 @@ impl PathExtensions for PathBuf {} /// A strategy for acquiring more subpaths to walk. pub trait Strategy { type P: PathExtensions; - /// Get additional subpaths from a given path. + /// Gets additional subpaths from a given path. fn get_more(&self, item: &Self::P) -> io::Result>; /// Determine whether a path should be walked further. /// This is run against each item from `get_more()`. @@ -44,7 +44,7 @@ pub struct Subpaths { } impl Subpaths { - /// 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> { let stack = strategy.get_more(p)?; Ok(Subpaths { stack: stack, strategy: strategy }) @@ -52,7 +52,7 @@ impl Subpaths { } impl Subpaths { - /// 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::new(p, Default::default()) } diff --git a/src/test/ui/issues/issue-48636.fixed b/src/test/ui/issues/issue-48636.fixed index 39e6c98b1f5b9..7d76f9a99be7b 100644 --- a/src/test/ui/issues/issue-48636.fixed +++ b/src/test/ui/issues/issue-48636.fixed @@ -4,7 +4,7 @@ struct S { x: u8, - /// The id of the parent core + /// The ID of the parent core y: u8, } //~^^^ ERROR found a documentation comment that doesn't document anything diff --git a/src/test/ui/issues/issue-48636.rs b/src/test/ui/issues/issue-48636.rs index bcf57772b515f..371c0ef6732f4 100644 --- a/src/test/ui/issues/issue-48636.rs +++ b/src/test/ui/issues/issue-48636.rs @@ -4,7 +4,7 @@ struct S { x: u8 - /// The id of the parent core + /// The ID of the parent core y: u8, } //~^^^ ERROR found a documentation comment that doesn't document anything diff --git a/src/test/ui/issues/issue-52126-assign-op-invariance.rs b/src/test/ui/issues/issue-52126-assign-op-invariance.rs index b974a8d4bdafb..c96cfdf3cd164 100644 --- a/src/test/ui/issues/issue-52126-assign-op-invariance.rs +++ b/src/test/ui/issues/issue-52126-assign-op-invariance.rs @@ -27,7 +27,7 @@ impl<'l> AddAssign for Counter<'l> } } -/// often times crashes, if not prints invalid strings +/// Often crashes, if not prints invalid strings. pub fn panics() { let mut acc = Counter{map: HashMap::new()}; for line in vec!["123456789".to_string(), "12345678".to_string()] { diff --git a/src/test/ui/nll/user-annotations/issue-55241.rs b/src/test/ui/nll/user-annotations/issue-55241.rs index e5600803df856..d7686b9dc9411 100644 --- a/src/test/ui/nll/user-annotations/issue-55241.rs +++ b/src/test/ui/nll/user-annotations/issue-55241.rs @@ -18,7 +18,7 @@ pub trait NodeCodec { } pub trait Trie> { - /// Return the root of the trie. + /// Returns the root of the trie. fn root(&self) -> &H::Out; /// Is the trie empty? diff --git a/src/test/ui/on-unimplemented/bad-annotation.rs b/src/test/ui/on-unimplemented/bad-annotation.rs index 6843c4bfa998a..846db63024cfb 100644 --- a/src/test/ui/on-unimplemented/bad-annotation.rs +++ b/src/test/ui/on-unimplemented/bad-annotation.rs @@ -10,7 +10,7 @@ trait Foo #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"] trait MyFromIterator { - /// Build a container with elements from an external iterator. + /// Builds a container with elements from an external iterator. fn my_from_iter>(iterator: T) -> Self; } diff --git a/src/test/ui/on-unimplemented/on-trait.rs b/src/test/ui/on-unimplemented/on-trait.rs index 22afda16f433a..109cb5ba96942 100644 --- a/src/test/ui/on-unimplemented/on-trait.rs +++ b/src/test/ui/on-unimplemented/on-trait.rs @@ -15,7 +15,7 @@ fn foobar>() -> T { #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"] trait MyFromIterator { - /// Build a container with elements from an external iterator. + /// Builds a container with elements from an external iterator. fn my_from_iter>(iterator: T) -> Self; } diff --git a/src/test/ui/svh/auxiliary/svh-b.rs b/src/test/ui/svh/auxiliary/svh-b.rs index 03869aeb37194..57029f70888b3 100644 --- a/src/test/ui/svh/auxiliary/svh-b.rs +++ b/src/test/ui/svh/auxiliary/svh-b.rs @@ -1,7 +1,7 @@ -//! This is a client of the `a` crate defined in "svn-a-base.rs". The -//! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use +//! This is a client of the `a` crate defined in `svn-a-base.rs`. The +//! rpass and cfail tests (such as `run-pass/svh-add-comment.rs`) use //! it by swapping in a different object code library crate built from -//! some variant of "svn-a-base.rs", and then we are checking if the +//! some variant of `svn-a-base.rs`, and then we are checking if the //! compiler properly ignores or accepts the change, based on whether //! the change could affect the downstream crate content or not //! (#14132).