@@ -111,13 +111,13 @@ pub trait Sized {
111
111
/// - `T` is not part of the type of any other fields
112
112
/// - `Bar<T>: Unsize<Bar<U>>`, if the last field of `Foo` has type `Bar<T>`
113
113
///
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
116
116
/// types. See the [DST coercion RFC][RFC982] and [the nomicon entry on coercion][nomicon-coerce]
117
117
/// for more details.
118
118
///
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
121
121
/// [RFC982]: https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md
122
122
/// [nomicon-coerce]: ../../nomicon/coercions.html
123
123
#[ unstable( feature = "unsize" , issue = "27732" ) ]
@@ -368,11 +368,7 @@ pub trait StructuralEq {
368
368
///
369
369
/// [`Vec<T>`]: ../../std/vec/struct.Vec.html
370
370
/// [`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
376
372
/// [impls]: #implementors
377
373
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
378
374
#[ lang = "copy" ]
@@ -400,18 +396,18 @@ pub macro Copy($item:item) {
400
396
/// This trait is automatically implemented when the compiler determines
401
397
/// it's appropriate.
402
398
///
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
405
401
/// [undefined behavior][ub] (including data races) when passing
406
402
/// `&T` references between threads.
407
403
///
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`]
411
407
/// types include "immutable" types like `&T`, and those with simple
412
408
/// 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`] .)
415
411
///
416
412
/// A somewhat surprising consequence of the definition is that `&mut T`
417
413
/// is `Sync` (if `T` is `Sync`) even though it seems like that might
@@ -421,15 +417,15 @@ pub macro Copy($item:item) {
421
417
/// of a data race.
422
418
///
423
419
/// 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
426
422
/// their contents even through an immutable, shared reference. For
427
423
/// example the `set` method on [`Cell<T>`][cell] takes `&self`, so it requires
428
424
/// only a shared reference [`&Cell<T>`][cell]. The method performs no
429
425
/// synchronization, thus [`Cell`][cell] cannot be `Sync`.
430
426
///
431
427
/// 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
433
429
/// a new [`Rc<T>`][rc], modifying the reference counts in a non-atomic way.
434
430
///
435
431
/// For cases when one does need thread-safe interior mutability,
@@ -445,24 +441,21 @@ pub macro Copy($item:item) {
445
441
/// [undefined behavior][ub]. For example, [`transmute`][transmute]-ing
446
442
/// from `&T` to `&mut T` is invalid.
447
443
///
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`.
450
445
///
451
- /// [send]: trait.Send.html
452
- /// [u8]: ../../std/primitive.u8.html
453
- /// [f64]: ../../std/primitive.f64.html
454
446
/// [box]: ../../std/boxed/struct.Box.html
455
447
/// [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
458
450
/// [rc]: ../../std/rc/struct.Rc.html
459
451
/// [arc]: ../../std/sync/struct.Arc.html
460
- /// [atomic data types]: ../ sync/ atomic/index.html
452
+ /// [atomic data types]: crate:: sync:: atomic
461
453
/// [mutex]: ../../std/sync/struct.Mutex.html
462
454
/// [rwlock]: ../../std/sync/struct.RwLock.html
463
- /// [unsafecell]: ../ cell/struct. UnsafeCell.html
455
+ /// [unsafecell]: crate:: cell:: UnsafeCell
464
456
/// [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
466
459
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
467
460
#[ cfg_attr( not( test) , rustc_diagnostic_item = "sync_trait" ) ]
468
461
#[ lang = "sync" ]
@@ -698,7 +691,7 @@ mod impls {
698
691
/// guarantees to [`mem::Discriminant`]. It is **undefined behavior** to transmute
699
692
/// between `DiscriminantKind::Discriminant` and `mem::Discriminant`.
700
693
///
701
- /// [`mem::Discriminant`]: https://doc.rust-lang.org/stable/core/ mem/struct. Discriminant.html
694
+ /// [`mem::Discriminant`]: crate:: mem:: Discriminant
702
695
#[ unstable(
703
696
feature = "discriminant_kind" ,
704
697
issue = "none" ,
@@ -733,7 +726,7 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
733
726
///
734
727
/// The [`Pin`][Pin] type is used instead to prevent moves through the type
735
728
/// 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
737
730
/// pinning.
738
731
///
739
732
/// Implementing the `Unpin` trait for `T` lifts the restrictions of pinning off
@@ -764,9 +757,9 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
764
757
///
765
758
/// This trait is automatically implemented for almost every type.
766
759
///
767
- /// [`mem::replace`]: ../../std/ mem/fn. replace.html
760
+ /// [`mem::replace`]: crate:: mem:: replace
768
761
/// [Pin]: crate::pin::Pin
769
- /// [`pin module` ]: crate::pin
762
+ /// [`pin` module]: crate::pin
770
763
#[ stable( feature = "pin" , since = "1.33.0" ) ]
771
764
#[ rustc_on_unimplemented(
772
765
on( _Self = "std::future::Future" , note = "consider using `Box::pin`" , ) ,
0 commit comments