Skip to content

Commit af331a2

Browse files
authored
Rollup merge of rust-lang#76261 - camelid:intra-doc-links-for-core-marker, r=jyn514
Use intra-doc links in `core::marker` Part of rust-lang#75080. Also cleaned up a few things. --- @rustbot modify labels: A-intra-doc-links T-doc
2 parents 1f7ff67 + 7926435 commit af331a2

File tree

1 file changed

+26
-33
lines changed

1 file changed

+26
-33
lines changed

library/core/src/marker.rs

+26-33
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ pub trait Sized {
111111
/// - `T` is not part of the type of any other fields
112112
/// - `Bar<T>: Unsize<Bar<U>>`, if the last field of `Foo` has type `Bar<T>`
113113
///
114-
/// `Unsize` is used along with [`ops::CoerceUnsized`][coerceunsized] to allow
115-
/// "user-defined" containers such as [`rc::Rc`][rc] to contain dynamically-sized
114+
/// `Unsize` is used along with [`ops::CoerceUnsized`] to allow
115+
/// "user-defined" containers such as [`Rc`] to contain dynamically-sized
116116
/// types. See the [DST coercion RFC][RFC982] and [the nomicon entry on coercion][nomicon-coerce]
117117
/// for more details.
118118
///
119-
/// [coerceunsized]: ../ops/trait.CoerceUnsized.html
120-
/// [rc]: ../../std/rc/struct.Rc.html
119+
/// [`ops::CoerceUnsized`]: crate::ops::CoerceUnsized
120+
/// [`Rc`]: ../../std/rc/struct.Rc.html
121121
/// [RFC982]: https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md
122122
/// [nomicon-coerce]: ../../nomicon/coercions.html
123123
#[unstable(feature = "unsize", issue = "27732")]
@@ -368,11 +368,7 @@ pub trait StructuralEq {
368368
///
369369
/// [`Vec<T>`]: ../../std/vec/struct.Vec.html
370370
/// [`String`]: ../../std/string/struct.String.html
371-
/// [`Drop`]: ../../std/ops/trait.Drop.html
372-
/// [`size_of::<T>`]: ../../std/mem/fn.size_of.html
373-
/// [`Clone`]: ../clone/trait.Clone.html
374-
/// [`String`]: ../../std/string/struct.String.html
375-
/// [`i32`]: ../../std/primitive.i32.html
371+
/// [`size_of::<T>`]: crate::mem::size_of
376372
/// [impls]: #implementors
377373
#[stable(feature = "rust1", since = "1.0.0")]
378374
#[lang = "copy"]
@@ -400,18 +396,18 @@ pub macro Copy($item:item) {
400396
/// This trait is automatically implemented when the compiler determines
401397
/// it's appropriate.
402398
///
403-
/// The precise definition is: a type `T` is `Sync` if and only if `&T` is
404-
/// [`Send`][send]. In other words, if there is no possibility of
399+
/// The precise definition is: a type `T` is [`Sync`] if and only if `&T` is
400+
/// [`Send`]. In other words, if there is no possibility of
405401
/// [undefined behavior][ub] (including data races) when passing
406402
/// `&T` references between threads.
407403
///
408-
/// As one would expect, primitive types like [`u8`][u8] and [`f64`][f64]
409-
/// are all `Sync`, and so are simple aggregate types containing them,
410-
/// like tuples, structs and enums. More examples of basic `Sync`
404+
/// As one would expect, primitive types like [`u8`] and [`f64`]
405+
/// are all [`Sync`], and so are simple aggregate types containing them,
406+
/// like tuples, structs and enums. More examples of basic [`Sync`]
411407
/// types include "immutable" types like `&T`, and those with simple
412408
/// inherited mutability, such as [`Box<T>`][box], [`Vec<T>`][vec] and
413-
/// most other collection types. (Generic parameters need to be `Sync`
414-
/// for their container to be `Sync`.)
409+
/// most other collection types. (Generic parameters need to be [`Sync`]
410+
/// for their container to be [`Sync`].)
415411
///
416412
/// A somewhat surprising consequence of the definition is that `&mut T`
417413
/// is `Sync` (if `T` is `Sync`) even though it seems like that might
@@ -421,15 +417,15 @@ pub macro Copy($item:item) {
421417
/// of a data race.
422418
///
423419
/// Types that are not `Sync` are those that have "interior
424-
/// mutability" in a non-thread-safe form, such as [`cell::Cell`][cell]
425-
/// and [`cell::RefCell`][refcell]. These types allow for mutation of
420+
/// mutability" in a non-thread-safe form, such as [`Cell`][cell]
421+
/// and [`RefCell`][refcell]. These types allow for mutation of
426422
/// their contents even through an immutable, shared reference. For
427423
/// example the `set` method on [`Cell<T>`][cell] takes `&self`, so it requires
428424
/// only a shared reference [`&Cell<T>`][cell]. The method performs no
429425
/// synchronization, thus [`Cell`][cell] cannot be `Sync`.
430426
///
431427
/// Another example of a non-`Sync` type is the reference-counting
432-
/// pointer [`rc::Rc`][rc]. Given any reference [`&Rc<T>`][rc], you can clone
428+
/// pointer [`Rc`][rc]. Given any reference [`&Rc<T>`][rc], you can clone
433429
/// a new [`Rc<T>`][rc], modifying the reference counts in a non-atomic way.
434430
///
435431
/// For cases when one does need thread-safe interior mutability,
@@ -445,24 +441,21 @@ pub macro Copy($item:item) {
445441
/// [undefined behavior][ub]. For example, [`transmute`][transmute]-ing
446442
/// from `&T` to `&mut T` is invalid.
447443
///
448-
/// See [the Nomicon](../../nomicon/send-and-sync.html) for more
449-
/// details about `Sync`.
444+
/// See [the Nomicon][nomicon-send-and-sync] for more details about `Sync`.
450445
///
451-
/// [send]: trait.Send.html
452-
/// [u8]: ../../std/primitive.u8.html
453-
/// [f64]: ../../std/primitive.f64.html
454446
/// [box]: ../../std/boxed/struct.Box.html
455447
/// [vec]: ../../std/vec/struct.Vec.html
456-
/// [cell]: ../cell/struct.Cell.html
457-
/// [refcell]: ../cell/struct.RefCell.html
448+
/// [cell]: crate::cell::Cell
449+
/// [refcell]: crate::cell::RefCell
458450
/// [rc]: ../../std/rc/struct.Rc.html
459451
/// [arc]: ../../std/sync/struct.Arc.html
460-
/// [atomic data types]: ../sync/atomic/index.html
452+
/// [atomic data types]: crate::sync::atomic
461453
/// [mutex]: ../../std/sync/struct.Mutex.html
462454
/// [rwlock]: ../../std/sync/struct.RwLock.html
463-
/// [unsafecell]: ../cell/struct.UnsafeCell.html
455+
/// [unsafecell]: crate::cell::UnsafeCell
464456
/// [ub]: ../../reference/behavior-considered-undefined.html
465-
/// [transmute]: ../../std/mem/fn.transmute.html
457+
/// [transmute]: crate::mem::transmute
458+
/// [nomicon-send-and-sync]: ../../nomicon/send-and-sync.html
466459
#[stable(feature = "rust1", since = "1.0.0")]
467460
#[cfg_attr(not(test), rustc_diagnostic_item = "sync_trait")]
468461
#[lang = "sync"]
@@ -698,7 +691,7 @@ mod impls {
698691
/// guarantees to [`mem::Discriminant`]. It is **undefined behavior** to transmute
699692
/// between `DiscriminantKind::Discriminant` and `mem::Discriminant`.
700693
///
701-
/// [`mem::Discriminant`]: https://doc.rust-lang.org/stable/core/mem/struct.Discriminant.html
694+
/// [`mem::Discriminant`]: crate::mem::Discriminant
702695
#[unstable(
703696
feature = "discriminant_kind",
704697
issue = "none",
@@ -733,7 +726,7 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
733726
///
734727
/// The [`Pin`][Pin] type is used instead to prevent moves through the type
735728
/// system. Pointers `P<T>` wrapped in the [`Pin<P<T>>`][Pin] wrapper can't be
736-
/// moved out of. See the [`pin module`] documentation for more information on
729+
/// moved out of. See the [`pin` module] documentation for more information on
737730
/// pinning.
738731
///
739732
/// Implementing the `Unpin` trait for `T` lifts the restrictions of pinning off
@@ -764,9 +757,9 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
764757
///
765758
/// This trait is automatically implemented for almost every type.
766759
///
767-
/// [`mem::replace`]: ../../std/mem/fn.replace.html
760+
/// [`mem::replace`]: crate::mem::replace
768761
/// [Pin]: crate::pin::Pin
769-
/// [`pin module`]: crate::pin
762+
/// [`pin` module]: crate::pin
770763
#[stable(feature = "pin", since = "1.33.0")]
771764
#[rustc_on_unimplemented(
772765
on(_Self = "std::future::Future", note = "consider using `Box::pin`",),

0 commit comments

Comments
 (0)