From b5c04e6d9e9063a0479fcfb125b0f03385d43332 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Thu, 1 Aug 2019 15:07:40 +0700 Subject: [PATCH 1/4] FixedSizeArray: Add missing links in doc comments. --- src/libcore/array.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 517893a1967dc..b5614010e5c2f 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -24,9 +24,12 @@ use crate::slice::{Iter, IterMut}; /// layout in memory of a fixed size array (for example, for unsafe /// initialization). /// -/// Note that the traits AsRef and AsMut provide similar methods for types that +/// Note that the traits [`AsRef`] and [`AsMut`] provide similar methods for types that /// may not be fixed-size arrays. Implementors should prefer those traits /// instead. +/// +/// [`AsRef`]: ../convert/trait.AsRef.html +/// [`AsMut`]: ../convert/trait.AsMut.html #[unstable(feature = "fixed_size_array", issue = "27778")] pub unsafe trait FixedSizeArray { /// Converts the array to immutable slice From 86633b63894438a8eaad521ccca98d66104579ba Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Thu, 1 Aug 2019 15:13:31 +0700 Subject: [PATCH 2/4] Fix typos in doc comments. --- src/libcore/convert.rs | 2 +- src/libcore/mem/maybe_uninit.rs | 2 +- src/libcore/ptr/mod.rs | 4 ++-- src/librustc/traits/select.rs | 4 ++-- src/libsyntax/parse/mod.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index db3dde3fea6bd..624b13d96472c 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -427,7 +427,7 @@ pub trait TryInto: Sized { /// - [`try_from`] is reflexive, which means that `TryFrom for T` /// is implemented and cannot fail -- the associated `Error` type for /// calling `T::try_from()` on a value of type `T` is [`Infallible`]. -/// When the [`!`] type is stablized [`Infallible`] and [`!`] will be +/// When the [`!`] type is stabilized [`Infallible`] and [`!`] will be /// equivalent. /// /// `TryFrom` can be implemented as follows: diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs index 2e88db8df1163..64fdf504369f2 100644 --- a/src/libcore/mem/maybe_uninit.rs +++ b/src/libcore/mem/maybe_uninit.rs @@ -434,7 +434,7 @@ impl MaybeUninit { /// Reads the value from the `MaybeUninit` container. The resulting `T` is subject /// to the usual drop handling. /// - /// Whenever possible, it is preferrable to use [`assume_init`] instead, which + /// Whenever possible, it is preferable to use [`assume_init`] instead, which /// prevents duplicating the content of the `MaybeUninit`. /// /// # Safety diff --git a/src/libcore/ptr/mod.rs b/src/libcore/ptr/mod.rs index a1f96905dc99b..0ec4dd47b1ff0 100644 --- a/src/libcore/ptr/mod.rs +++ b/src/libcore/ptr/mod.rs @@ -1611,7 +1611,7 @@ impl *const T { /// The offset is expressed in number of `T` elements, and not bytes. The value returned can be /// used with the `add` method. /// - /// There are no guarantees whatsover that offsetting the pointer will not overflow or go + /// There are no guarantees whatsoever that offsetting the pointer will not overflow or go /// beyond the allocation that the pointer points into. It is up to the caller to ensure that /// the returned offset is correct in all terms other than alignment. /// @@ -2412,7 +2412,7 @@ impl *mut T { /// The offset is expressed in number of `T` elements, and not bytes. The value returned can be /// used with the `add` method. /// - /// There are no guarantees whatsover that offsetting the pointer will not overflow or go + /// There are no guarantees whatsoever that offsetting the pointer will not overflow or go /// beyond the allocation that the pointer points into. It is up to the caller to ensure that /// the returned offset is correct in all terms other than alignment. /// diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 798a25fe7b1bc..2486f29ab0f22 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -167,7 +167,7 @@ struct TraitObligationStack<'prev, 'tcx> { /// ok on the premise that if `A: AutoTrait` held, but we indeed /// encountered a problem (later on) with `A: AutoTrait. So we /// currently set a flag on the stack node for `B: AutoTrait` (as - /// well as the second instance of `A: AutoTrait`) to supress + /// well as the second instance of `A: AutoTrait`) to suppress /// caching. /// /// This is a simple, targeted fix. A more-performant fix requires @@ -1105,7 +1105,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { /// /// - is a defaulted trait, /// - it also appears in the backtrace at some position `X`, - /// - all the predicates at positions `X..` between `X` an the top are + /// - all the predicates at positions `X..` between `X` and the top are /// also defaulted traits. pub fn coinductive_match(&mut self, cycle: I) -> bool where diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 1aac8bbb7aa46..002aa2f891e4b 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -368,7 +368,7 @@ pub fn stream_to_parser_with_base_dir<'a>( /// A sequence separator. pub struct SeqSep { - /// The seperator token. + /// The separator token. pub sep: Option, /// `true` if a trailing separator is allowed. pub trailing_sep_allowed: bool, From ae65848d9e088b40f0f2a45c60b2182e6ee65138 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Thu, 1 Aug 2019 15:13:53 +0700 Subject: [PATCH 3/4] Remove extraneous {} in use stmts in doc comments. --- src/libstd/ffi/c_str.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 585731fb30e57..6e111f2423659 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -1055,7 +1055,7 @@ impl CStr { /// /// ```no_run /// # #![allow(unused_must_use)] - /// use std::ffi::{CString}; + /// use std::ffi::CString; /// /// let ptr = CString::new("Hello").expect("CString::new failed").as_ptr(); /// unsafe { @@ -1071,7 +1071,7 @@ impl CStr { /// /// ```no_run /// # #![allow(unused_must_use)] - /// use std::ffi::{CString}; + /// use std::ffi::CString; /// /// let hello = CString::new("Hello").expect("CString::new failed"); /// let ptr = hello.as_ptr(); From 325c6a56c274678f294bfa25ee43e1eef48f46a2 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Fri, 2 Aug 2019 01:39:25 +0700 Subject: [PATCH 4/4] Futures: Add link to Waker in trait doc. --- src/libcore/future/future.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcore/future/future.rs b/src/libcore/future/future.rs index 8bd1601a36213..593c01060ca49 100644 --- a/src/libcore/future/future.rs +++ b/src/libcore/future/future.rs @@ -17,11 +17,13 @@ use crate::task::{Context, Poll}; /// final value. This method does not block if the value is not ready. Instead, /// the current task is scheduled to be woken up when it's possible to make /// further progress by `poll`ing again. The `context` passed to the `poll` -/// method can provide a `Waker`, which is a handle for waking up the current +/// method can provide a [`Waker`], which is a handle for waking up the current /// task. /// /// When using a future, you generally won't call `poll` directly, but instead /// `.await` the value. +/// +/// [`Waker`]: ../task/struct.Waker.html #[doc(spotlight)] #[must_use = "futures do nothing unless you `.await` or poll them"] #[stable(feature = "futures_api", since = "1.36.0")]