-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Use intra-doc links in core::marker
#76261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bors
merged 2 commits into
rust-lang:master
from
camelid:intra-doc-links-for-core-marker
Sep 3, 2020
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,13 +111,13 @@ pub trait Sized { | |
/// - `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>` | ||
/// | ||
/// `Unsize` is used along with [`ops::CoerceUnsized`][coerceunsized] to allow | ||
/// "user-defined" containers such as [`rc::Rc`][rc] to contain dynamically-sized | ||
/// `Unsize` is used along with [`ops::CoerceUnsized`] to allow | ||
/// "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] | ||
/// for more details. | ||
/// | ||
/// [coerceunsized]: ../ops/trait.CoerceUnsized.html | ||
/// [rc]: ../../std/rc/struct.Rc.html | ||
/// [`ops::CoerceUnsized`]: crate::ops::CoerceUnsized | ||
/// [`Rc`]: ../../std/rc/struct.Rc.html | ||
/// [RFC982]: https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md | ||
/// [nomicon-coerce]: ../../nomicon/coercions.html | ||
#[unstable(feature = "unsize", issue = "27732")] | ||
|
@@ -368,11 +368,7 @@ pub trait StructuralEq { | |
/// | ||
/// [`Vec<T>`]: ../../std/vec/struct.Vec.html | ||
/// [`String`]: ../../std/string/struct.String.html | ||
/// [`Drop`]: ../../std/ops/trait.Drop.html | ||
/// [`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 | ||
/// [`size_of::<T>`]: crate::mem::size_of | ||
/// [impls]: #implementors | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[lang = "copy"] | ||
|
@@ -400,18 +396,18 @@ pub macro Copy($item:item) { | |
/// This trait is automatically implemented when the compiler determines | ||
/// it's appropriate. | ||
/// | ||
/// 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 | ||
/// The precise definition is: a type `T` is [`Sync`] if and only if `&T` is | ||
/// [`Send`]. In other words, if there is no possibility of | ||
/// [undefined behavior][ub] (including data races) when passing | ||
/// `&T` references between threads. | ||
/// | ||
/// As one would expect, primitive types like [`u8`][u8] and [`f64`][f64] | ||
/// are all `Sync`, and so are simple aggregate types containing them, | ||
/// like tuples, structs and enums. More examples of basic `Sync` | ||
/// As one would expect, primitive types like [`u8`] and [`f64`] | ||
/// are all [`Sync`], and so are simple aggregate types containing them, | ||
/// like tuples, structs and enums. More examples of basic [`Sync`] | ||
/// types include "immutable" types like `&T`, and those with simple | ||
/// inherited mutability, such as [`Box<T>`][box], [`Vec<T>`][vec] and | ||
/// most other collection types. (Generic parameters need to be `Sync` | ||
/// for their container to be `Sync`.) | ||
/// most other collection types. (Generic parameters need to be [`Sync`] | ||
/// for their container to be [`Sync`].) | ||
/// | ||
/// A somewhat surprising consequence of the definition is that `&mut T` | ||
/// is `Sync` (if `T` is `Sync`) even though it seems like that might | ||
|
@@ -421,48 +417,45 @@ pub macro Copy($item:item) { | |
/// of a data race. | ||
/// | ||
/// Types that are not `Sync` are those that have "interior | ||
/// mutability" in a non-thread-safe form, such as [`cell::Cell`][cell] | ||
/// and [`cell::RefCell`][refcell]. These types allow for mutation of | ||
/// mutability" in a non-thread-safe form, such as [`Cell`][cell] | ||
/// and [`RefCell`][refcell]. These types allow for mutation of | ||
/// their contents even through an immutable, shared reference. For | ||
/// example the `set` method on [`Cell<T>`][cell] takes `&self`, so it requires | ||
/// only a shared reference [`&Cell<T>`][cell]. The method performs no | ||
/// synchronization, thus [`Cell`][cell] cannot be `Sync`. | ||
/// | ||
/// 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. | ||
/// | ||
/// For cases when one does need thread-safe interior mutability, | ||
/// Rust provides [atomic data types], as well as explicit locking via | ||
/// [`sync::Mutex`][mutex] and [`sync::RwLock`][rwlock]. These types | ||
/// ensure that any mutation cannot cause data races, hence the types | ||
/// are `Sync`. Likewise, [`sync::Arc`][arc] provides a thread-safe | ||
/// analogue of [`Rc`][rc]. | ||
/// analogue of [`Rc`]. | ||
/// | ||
/// Any types with interior mutability must also use the | ||
/// [`cell::UnsafeCell`][unsafecell] wrapper around the value(s) which | ||
/// can be mutated through a shared reference. Failing to doing this is | ||
/// [undefined behavior][ub]. For example, [`transmute`][transmute]-ing | ||
/// from `&T` to `&mut T` is invalid. | ||
/// | ||
/// See [the Nomicon](../../nomicon/send-and-sync.html) for more | ||
/// details about `Sync`. | ||
/// See [the Nomicon][nomicon-send-and-sync] for more details about `Sync`. | ||
/// | ||
/// [send]: trait.Send.html | ||
/// [u8]: ../../std/primitive.u8.html | ||
/// [f64]: ../../std/primitive.f64.html | ||
/// [box]: ../../std/boxed/struct.Box.html | ||
/// [vec]: ../../std/vec/struct.Vec.html | ||
/// [cell]: ../cell/struct.Cell.html | ||
/// [refcell]: ../cell/struct.RefCell.html | ||
/// [cell]: crate::cell::Cell | ||
/// [refcell]: crate::cell::RefCell | ||
/// [rc]: ../../std/rc/struct.Rc.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 | ||
/// [rwlock]: ../../std/sync/struct.RwLock.html | ||
/// [unsafecell]: ../cell/struct.UnsafeCell.html | ||
/// [unsafecell]: crate::cell::UnsafeCell | ||
/// [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")] | ||
#[cfg_attr(not(test), rustc_diagnostic_item = "sync_trait")] | ||
#[lang = "sync"] | ||
|
@@ -698,7 +691,7 @@ mod impls { | |
/// guarantees to [`mem::Discriminant`]. It is **undefined behavior** to transmute | ||
/// 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( | ||
feature = "discriminant_kind", | ||
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 | ||
/// 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. | ||
/// | ||
/// 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. | ||
/// | ||
/// [`mem::replace`]: ../../std/mem/fn.replace.html | ||
/// [`mem::replace`]: crate::mem::replace | ||
/// [Pin]: crate::pin::Pin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like a few things were converted to intra-doc before! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank matklad :) #75780 |
||
/// [`pin module`]: crate::pin | ||
/// [`pin` module]: crate::pin | ||
#[stable(feature = "pin", since = "1.33.0")] | ||
#[rustc_on_unimplemented( | ||
on(_Self = "std::future::Future", note = "consider using `Box::pin`",), | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.