Rollup merge of #76261 - camelid:intra-doc-links-for-core-marker, r=jyn514

Use intra-doc links in `core::marker`

Part of #75080.

Also cleaned up a few things.

---

@rustbot modify labels: A-intra-doc-links T-doc
This commit is contained in:
Dylan DPC 2020-09-03 02:22:18 +02:00 committed by GitHub
commit af331a2d01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -111,13 +111,13 @@ pub trait Sized {
/// - `T` is not part of the type of any other fields /// - `T` is not part of the type of any other fields
/// - `Bar<T>: Unsize<Bar<U>>`, if the last field of `Foo` has type `Bar<T>` /// - `Bar<T>: Unsize<Bar<U>>`, if the last field of `Foo` has type `Bar<T>`
/// ///
/// `Unsize` is used along with [`ops::CoerceUnsized`][coerceunsized] to allow /// `Unsize` is used along with [`ops::CoerceUnsized`] to allow
/// "user-defined" containers such as [`rc::Rc`][rc] to contain dynamically-sized /// "user-defined" containers such as [`Rc`] to contain dynamically-sized
/// types. See the [DST coercion RFC][RFC982] and [the nomicon entry on coercion][nomicon-coerce] /// types. See the [DST coercion RFC][RFC982] and [the nomicon entry on coercion][nomicon-coerce]
/// for more details. /// for more details.
/// ///
/// [coerceunsized]: ../ops/trait.CoerceUnsized.html /// [`ops::CoerceUnsized`]: crate::ops::CoerceUnsized
/// [rc]: ../../std/rc/struct.Rc.html /// [`Rc`]: ../../std/rc/struct.Rc.html
/// [RFC982]: https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md /// [RFC982]: https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md
/// [nomicon-coerce]: ../../nomicon/coercions.html /// [nomicon-coerce]: ../../nomicon/coercions.html
#[unstable(feature = "unsize", issue = "27732")] #[unstable(feature = "unsize", issue = "27732")]
@ -368,11 +368,7 @@ pub trait StructuralEq {
/// ///
/// [`Vec<T>`]: ../../std/vec/struct.Vec.html /// [`Vec<T>`]: ../../std/vec/struct.Vec.html
/// [`String`]: ../../std/string/struct.String.html /// [`String`]: ../../std/string/struct.String.html
/// [`Drop`]: ../../std/ops/trait.Drop.html /// [`size_of::<T>`]: crate::mem::size_of
/// [`size_of::<T>`]: ../../std/mem/fn.size_of.html
/// [`Clone`]: ../clone/trait.Clone.html
/// [`String`]: ../../std/string/struct.String.html
/// [`i32`]: ../../std/primitive.i32.html
/// [impls]: #implementors /// [impls]: #implementors
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[lang = "copy"] #[lang = "copy"]
@ -400,18 +396,18 @@ pub macro Copy($item:item) {
/// This trait is automatically implemented when the compiler determines /// This trait is automatically implemented when the compiler determines
/// it's appropriate. /// it's appropriate.
/// ///
/// The precise definition is: a type `T` is `Sync` if and only if `&T` is /// The precise definition is: a type `T` is [`Sync`] if and only if `&T` is
/// [`Send`][send]. In other words, if there is no possibility of /// [`Send`]. In other words, if there is no possibility of
/// [undefined behavior][ub] (including data races) when passing /// [undefined behavior][ub] (including data races) when passing
/// `&T` references between threads. /// `&T` references between threads.
/// ///
/// As one would expect, primitive types like [`u8`][u8] and [`f64`][f64] /// As one would expect, primitive types like [`u8`] and [`f64`]
/// are all `Sync`, and so are simple aggregate types containing them, /// are all [`Sync`], and so are simple aggregate types containing them,
/// like tuples, structs and enums. More examples of basic `Sync` /// like tuples, structs and enums. More examples of basic [`Sync`]
/// types include "immutable" types like `&T`, and those with simple /// types include "immutable" types like `&T`, and those with simple
/// inherited mutability, such as [`Box<T>`][box], [`Vec<T>`][vec] and /// inherited mutability, such as [`Box<T>`][box], [`Vec<T>`][vec] and
/// most other collection types. (Generic parameters need to be `Sync` /// most other collection types. (Generic parameters need to be [`Sync`]
/// for their container to be `Sync`.) /// for their container to be [`Sync`].)
/// ///
/// A somewhat surprising consequence of the definition is that `&mut T` /// A somewhat surprising consequence of the definition is that `&mut T`
/// is `Sync` (if `T` is `Sync`) even though it seems like that might /// is `Sync` (if `T` is `Sync`) even though it seems like that might
@ -421,15 +417,15 @@ pub macro Copy($item:item) {
/// of a data race. /// of a data race.
/// ///
/// Types that are not `Sync` are those that have "interior /// Types that are not `Sync` are those that have "interior
/// mutability" in a non-thread-safe form, such as [`cell::Cell`][cell] /// mutability" in a non-thread-safe form, such as [`Cell`][cell]
/// and [`cell::RefCell`][refcell]. These types allow for mutation of /// and [`RefCell`][refcell]. These types allow for mutation of
/// their contents even through an immutable, shared reference. For /// their contents even through an immutable, shared reference. For
/// example the `set` method on [`Cell<T>`][cell] takes `&self`, so it requires /// example the `set` method on [`Cell<T>`][cell] takes `&self`, so it requires
/// only a shared reference [`&Cell<T>`][cell]. The method performs no /// only a shared reference [`&Cell<T>`][cell]. The method performs no
/// synchronization, thus [`Cell`][cell] cannot be `Sync`. /// synchronization, thus [`Cell`][cell] cannot be `Sync`.
/// ///
/// Another example of a non-`Sync` type is the reference-counting /// Another example of a non-`Sync` type is the reference-counting
/// pointer [`rc::Rc`][rc]. Given any reference [`&Rc<T>`][rc], you can clone /// pointer [`Rc`][rc]. Given any reference [`&Rc<T>`][rc], you can clone
/// a new [`Rc<T>`][rc], modifying the reference counts in a non-atomic way. /// a new [`Rc<T>`][rc], modifying the reference counts in a non-atomic way.
/// ///
/// For cases when one does need thread-safe interior mutability, /// For cases when one does need thread-safe interior mutability,
@ -445,24 +441,21 @@ pub macro Copy($item:item) {
/// [undefined behavior][ub]. For example, [`transmute`][transmute]-ing /// [undefined behavior][ub]. For example, [`transmute`][transmute]-ing
/// from `&T` to `&mut T` is invalid. /// from `&T` to `&mut T` is invalid.
/// ///
/// See [the Nomicon](../../nomicon/send-and-sync.html) for more /// See [the Nomicon][nomicon-send-and-sync] for more details about `Sync`.
/// details about `Sync`.
/// ///
/// [send]: trait.Send.html
/// [u8]: ../../std/primitive.u8.html
/// [f64]: ../../std/primitive.f64.html
/// [box]: ../../std/boxed/struct.Box.html /// [box]: ../../std/boxed/struct.Box.html
/// [vec]: ../../std/vec/struct.Vec.html /// [vec]: ../../std/vec/struct.Vec.html
/// [cell]: ../cell/struct.Cell.html /// [cell]: crate::cell::Cell
/// [refcell]: ../cell/struct.RefCell.html /// [refcell]: crate::cell::RefCell
/// [rc]: ../../std/rc/struct.Rc.html /// [rc]: ../../std/rc/struct.Rc.html
/// [arc]: ../../std/sync/struct.Arc.html /// [arc]: ../../std/sync/struct.Arc.html
/// [atomic data types]: ../sync/atomic/index.html /// [atomic data types]: crate::sync::atomic
/// [mutex]: ../../std/sync/struct.Mutex.html /// [mutex]: ../../std/sync/struct.Mutex.html
/// [rwlock]: ../../std/sync/struct.RwLock.html /// [rwlock]: ../../std/sync/struct.RwLock.html
/// [unsafecell]: ../cell/struct.UnsafeCell.html /// [unsafecell]: crate::cell::UnsafeCell
/// [ub]: ../../reference/behavior-considered-undefined.html /// [ub]: ../../reference/behavior-considered-undefined.html
/// [transmute]: ../../std/mem/fn.transmute.html /// [transmute]: crate::mem::transmute
/// [nomicon-send-and-sync]: ../../nomicon/send-and-sync.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "sync_trait")] #[cfg_attr(not(test), rustc_diagnostic_item = "sync_trait")]
#[lang = "sync"] #[lang = "sync"]
@ -698,7 +691,7 @@ mod impls {
/// guarantees to [`mem::Discriminant`]. It is **undefined behavior** to transmute /// guarantees to [`mem::Discriminant`]. It is **undefined behavior** to transmute
/// between `DiscriminantKind::Discriminant` and `mem::Discriminant`. /// between `DiscriminantKind::Discriminant` and `mem::Discriminant`.
/// ///
/// [`mem::Discriminant`]: https://doc.rust-lang.org/stable/core/mem/struct.Discriminant.html /// [`mem::Discriminant`]: crate::mem::Discriminant
#[unstable( #[unstable(
feature = "discriminant_kind", feature = "discriminant_kind",
issue = "none", issue = "none",
@ -733,7 +726,7 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
/// ///
/// The [`Pin`][Pin] type is used instead to prevent moves through the type /// The [`Pin`][Pin] type is used instead to prevent moves through the type
/// system. Pointers `P<T>` wrapped in the [`Pin<P<T>>`][Pin] wrapper can't be /// system. Pointers `P<T>` wrapped in the [`Pin<P<T>>`][Pin] wrapper can't be
/// moved out of. See the [`pin module`] documentation for more information on /// moved out of. See the [`pin` module] documentation for more information on
/// pinning. /// pinning.
/// ///
/// Implementing the `Unpin` trait for `T` lifts the restrictions of pinning off /// Implementing the `Unpin` trait for `T` lifts the restrictions of pinning off
@ -764,9 +757,9 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
/// ///
/// This trait is automatically implemented for almost every type. /// This trait is automatically implemented for almost every type.
/// ///
/// [`mem::replace`]: ../../std/mem/fn.replace.html /// [`mem::replace`]: crate::mem::replace
/// [Pin]: crate::pin::Pin /// [Pin]: crate::pin::Pin
/// [`pin module`]: crate::pin /// [`pin` module]: crate::pin
#[stable(feature = "pin", since = "1.33.0")] #[stable(feature = "pin", since = "1.33.0")]
#[rustc_on_unimplemented( #[rustc_on_unimplemented(
on(_Self = "std::future::Future", note = "consider using `Box::pin`",), on(_Self = "std::future::Future", note = "consider using `Box::pin`",),