Skip to content

Commit 58310ce

Browse files
committed
Use intra-doc links in core::mem
1 parent 141bb23 commit 58310ce

File tree

1 file changed

+17
-40
lines changed

1 file changed

+17
-40
lines changed

library/core/src/mem/mod.rs

+17-40
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ pub use crate::intrinsics::transmute;
3131
/// forever in an unreachable state. However, it does not guarantee that pointers
3232
/// to this memory will remain valid.
3333
///
34-
/// * If you want to leak memory, see [`Box::leak`][leak].
35-
/// * If you want to obtain a raw pointer to the memory, see [`Box::into_raw`][into_raw].
34+
/// * If you want to leak memory, see [`Box::leak`].
35+
/// * If you want to obtain a raw pointer to the memory, see [`Box::into_raw`].
3636
/// * If you want to dispose of a value properly, running its destructor, see
37-
/// [`mem::drop`][drop].
37+
/// [`mem::drop`].
3838
///
3939
/// # Safety
4040
///
@@ -132,15 +132,11 @@ pub use crate::intrinsics::transmute;
132132
/// ownership to `s` — the final step of interacting with `v` to dispose of it without
133133
/// running its destructor is entirely avoided.
134134
///
135-
/// [drop]: fn.drop.html
136-
/// [uninit]: fn.uninitialized.html
137-
/// [clone]: ../clone/trait.Clone.html
138-
/// [swap]: fn.swap.html
139-
/// [box]: ../../std/boxed/struct.Box.html
140-
/// [leak]: ../../std/boxed/struct.Box.html#method.leak
141-
/// [into_raw]: ../../std/boxed/struct.Box.html#method.into_raw
135+
/// [`Box`]: ../../std/boxed/struct.Box.html
136+
/// [`Box::leak`]: ../../std/boxed/struct.Box.html#method.leak
137+
/// [`Box::into_raw`]: ../../std/boxed/struct.Box.html#method.into_raw
138+
/// [`mem::drop`]: drop
142139
/// [ub]: ../../reference/behavior-considered-undefined.html
143-
/// [`ManuallyDrop`]: struct.ManuallyDrop.html
144140
#[inline]
145141
#[rustc_const_stable(feature = "const_forget", since = "1.46.0")]
146142
#[stable(feature = "rust1", since = "1.0.0")]
@@ -152,8 +148,6 @@ pub const fn forget<T>(t: T) {
152148
///
153149
/// This function is just a shim intended to be removed when the `unsized_locals` feature gets
154150
/// stabilized.
155-
///
156-
/// [`forget`]: fn.forget.html
157151
#[inline]
158152
#[unstable(feature = "forget_unsized", issue = "none")]
159153
pub fn forget_unsized<T: ?Sized>(t: T) {
@@ -301,7 +295,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
301295
/// assert_eq!(2, mem::size_of::<ExampleUnion>());
302296
/// ```
303297
///
304-
/// [alignment]: ./fn.align_of.html
298+
/// [alignment]: align_of
305299
#[inline(always)]
306300
#[stable(feature = "rust1", since = "1.0.0")]
307301
#[rustc_promotable]
@@ -365,7 +359,6 @@ pub const fn size_of_val<T: ?Sized>(val: &T) -> usize {
365359
/// [slice]: ../../std/primitive.slice.html
366360
/// [trait object]: ../../book/ch17-02-trait-objects.html
367361
/// [extern type]: ../../unstable-book/language-features/extern-types.html
368-
/// [`size_of_val`]: ../../core/mem/fn.size_of_val.html
369362
///
370363
/// # Examples
371364
///
@@ -501,7 +494,6 @@ pub const fn align_of_val<T: ?Sized>(val: &T) -> usize {
501494
/// [slice]: ../../std/primitive.slice.html
502495
/// [trait object]: ../../book/ch17-02-trait-objects.html
503496
/// [extern type]: ../../unstable-book/language-features/extern-types.html
504-
/// [`align_of_val`]: ../../core/mem/fn.align_of_val.html
505497
///
506498
/// # Examples
507499
///
@@ -540,7 +532,7 @@ pub unsafe fn align_of_val_raw<T: ?Sized>(val: *const T) -> usize {
540532
/// `needs_drop` explicitly. Types like [`HashMap`], on the other hand, have to drop
541533
/// values one at a time and should use this API.
542534
///
543-
/// [`drop_in_place`]: ../ptr/fn.drop_in_place.html
535+
/// [`drop_in_place`]: crate::ptr::drop_in_place
544536
/// [`HashMap`]: ../../std/collections/struct.HashMap.html
545537
///
546538
/// # Examples
@@ -595,9 +587,9 @@ pub const fn needs_drop<T>() -> bool {
595587
/// This has the same effect as [`MaybeUninit::zeroed().assume_init()`][zeroed].
596588
/// It is useful for FFI sometimes, but should generally be avoided.
597589
///
598-
/// [zeroed]: union.MaybeUninit.html#method.zeroed
590+
/// [zeroed]: MaybeUninit::zeroed
599591
/// [ub]: ../../reference/behavior-considered-undefined.html
600-
/// [inv]: union.MaybeUninit.html#initialization-invariant
592+
/// [inv]: MaybeUninit#initialization-invariant
601593
///
602594
/// # Examples
603595
///
@@ -650,10 +642,10 @@ pub unsafe fn zeroed<T>() -> T {
650642
/// (Notice that the rules around uninitialized integers are not finalized yet, but
651643
/// until they are, it is advisable to avoid them.)
652644
///
653-
/// [`MaybeUninit<T>`]: union.MaybeUninit.html
654-
/// [uninit]: union.MaybeUninit.html#method.uninit
655-
/// [assume_init]: union.MaybeUninit.html#method.assume_init
656-
/// [inv]: union.MaybeUninit.html#initialization-invariant
645+
/// [`MaybeUninit<T>`]: MaybeUninit
646+
/// [uninit]: MaybeUninit::uninit
647+
/// [assume_init]: MaybeUninit::assume_init
648+
/// [inv]: MaybeUninit#initialization-invariant
657649
#[inline(always)]
658650
#[rustc_deprecated(since = "1.39.0", reason = "use `mem::MaybeUninit` instead")]
659651
#[stable(feature = "rust1", since = "1.0.0")]
@@ -686,9 +678,6 @@ pub unsafe fn uninitialized<T>() -> T {
686678
/// assert_eq!(42, x);
687679
/// assert_eq!(5, y);
688680
/// ```
689-
///
690-
/// [`replace`]: fn.replace.html
691-
/// [`take`]: fn.take.html
692681
#[inline]
693682
#[stable(feature = "rust1", since = "1.0.0")]
694683
pub fn swap<T>(x: &mut T, y: &mut T) {
@@ -754,10 +743,6 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
754743
/// assert_eq!(buffer.get_and_reset(), vec![0, 1]);
755744
/// assert_eq!(buffer.buf.len(), 0);
756745
/// ```
757-
///
758-
/// [`Clone`]: ../../std/clone/trait.Clone.html
759-
/// [`replace`]: fn.replace.html
760-
/// [`swap`]: fn.swap.html
761746
#[inline]
762747
#[stable(feature = "mem_take", since = "1.40.0")]
763748
pub fn take<T: Default>(dest: &mut T) -> T {
@@ -822,10 +807,6 @@ pub fn take<T: Default>(dest: &mut T) -> T {
822807
/// assert_eq!(buffer.replace_index(0, 2), 0);
823808
/// assert_eq!(buffer.buf[0], 2);
824809
/// ```
825-
///
826-
/// [`Clone`]: ../../std/clone/trait.Clone.html
827-
/// [`swap`]: fn.swap.html
828-
/// [`take`]: fn.take.html
829810
#[inline]
830811
#[stable(feature = "rust1", since = "1.0.0")]
831812
#[must_use = "if you don't need the old value, you can just assign the new value directly"]
@@ -851,7 +832,7 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
851832
/// Because `_x` is moved into the function, it is automatically dropped before
852833
/// the function returns.
853834
///
854-
/// [drop]: ../ops/trait.Drop.html
835+
/// [drop]: Drop
855836
///
856837
/// # Examples
857838
///
@@ -894,8 +875,7 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
894875
/// println!("x: {}, y: {}", x, y.0); // still available
895876
/// ```
896877
///
897-
/// [`RefCell`]: ../../std/cell/struct.RefCell.html
898-
/// [`Copy`]: ../../std/marker/trait.Copy.html
878+
/// [`RefCell`]: crate::cell::RefCell
899879
#[inline]
900880
#[stable(feature = "rust1", since = "1.0.0")]
901881
pub fn drop<T>(_x: T) {}
@@ -914,7 +894,6 @@ pub fn drop<T>(_x: T) {}
914894
/// `T`.
915895
///
916896
/// [ub]: ../../reference/behavior-considered-undefined.html
917-
/// [size_of]: fn.size_of.html
918897
///
919898
/// # Examples
920899
///
@@ -960,8 +939,6 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
960939
/// Opaque type representing the discriminant of an enum.
961940
///
962941
/// See the [`discriminant`] function in this module for more information.
963-
///
964-
/// [`discriminant`]: fn.discriminant.html
965942
#[stable(feature = "discriminant_value", since = "1.21.0")]
966943
pub struct Discriminant<T>(<T as DiscriminantKind>::Discriminant);
967944

0 commit comments

Comments
 (0)