From 91e4aaa736004284ec9116f7ff439fb9bbfc471e Mon Sep 17 00:00:00 2001 From: Amjad Alsharafi Date: Wed, 26 Aug 2020 13:47:35 +0800 Subject: [PATCH 1/5] Use intra-doc links for `core/src/slice.mod.rs` - most are using primitive types links, which cannot be used with intra links at the moment - also `std` cannot be referenced in any link --- library/core/src/slice/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 0d97ddb29af79..957729898af9d 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -5390,7 +5390,7 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksMut<'a, T> { /// This struct is created by the [`chunks_exact`] method on [slices]. /// /// [`chunks_exact`]: ../../std/primitive.slice.html#method.chunks_exact -/// [`remainder`]: ../../std/slice/struct.ChunksExact.html#method.remainder +/// [`remainder`]: crate::slice::ChunksExact::remainder /// [slices]: ../../std/primitive.slice.html #[derive(Debug)] #[stable(feature = "chunks_exact", since = "1.31.0")] @@ -5530,7 +5530,7 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksExact<'a, T> { /// This struct is created by the [`chunks_exact_mut`] method on [slices]. /// /// [`chunks_exact_mut`]: ../../std/primitive.slice.html#method.chunks_exact_mut -/// [`into_remainder`]: ../../std/slice/struct.ChunksExactMut.html#method.into_remainder +/// [`into_remainder`]: crate::slice::ChunksExactMut::into_remainder /// [slices]: ../../std/primitive.slice.html #[derive(Debug)] #[stable(feature = "chunks_exact", since = "1.31.0")] @@ -5667,7 +5667,7 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksExactMut<'a, T> { /// This struct is created by the [`array_chunks`] method on [slices]. /// /// [`array_chunks`]: ../../std/primitive.slice.html#method.array_chunks -/// [`remainder`]: ../../std/slice/struct.ArrayChunks.html#method.remainder +/// [`remainder`]: crate::slice::ArrayChunks::remainder /// [slices]: ../../std/primitive.slice.html #[derive(Debug)] #[unstable(feature = "array_chunks", issue = "74985")] @@ -6072,7 +6072,7 @@ unsafe impl<'a, T> TrustedRandomAccess for RChunksMut<'a, T> { /// This struct is created by the [`rchunks_exact`] method on [slices]. /// /// [`rchunks_exact`]: ../../std/primitive.slice.html#method.rchunks_exact -/// [`remainder`]: ../../std/slice/struct.ChunksExact.html#method.remainder +/// [`remainder`]: crate::slice::ChunksExact::remainder /// [slices]: ../../std/primitive.slice.html #[derive(Debug)] #[stable(feature = "rchunks", since = "1.31.0")] @@ -6217,7 +6217,7 @@ unsafe impl<'a, T> TrustedRandomAccess for RChunksExact<'a, T> { /// This struct is created by the [`rchunks_exact_mut`] method on [slices]. /// /// [`rchunks_exact_mut`]: ../../std/primitive.slice.html#method.rchunks_exact_mut -/// [`into_remainder`]: ../../std/slice/struct.ChunksExactMut.html#method.into_remainder +/// [`into_remainder`]: crate::slice::ChunksExactMut::into_remainder /// [slices]: ../../std/primitive.slice.html #[derive(Debug)] #[stable(feature = "rchunks", since = "1.31.0")] @@ -6470,7 +6470,7 @@ pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] { /// [valid]: ../../std/ptr/index.html#safety /// [`NonNull::dangling()`]: ../../std/ptr/struct.NonNull.html#method.dangling /// [`pointer::offset`]: ../../std/primitive.pointer.html#method.offset -/// [`from_raw_parts`]: ../../std/slice/fn.from_raw_parts.html +/// [`from_raw_parts`]: crate::slice::from_raw_parts #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T] { From 8e33137159b3b7a8a524bb7bebc270a9bfbcb822 Mon Sep 17 00:00:00 2001 From: Amjad Alsharafi Date: Wed, 26 Aug 2020 21:53:47 +0800 Subject: [PATCH 2/5] Fixes `intra-doc` same scope links --- library/core/src/slice/mod.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 957729898af9d..762100bab94fb 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -5390,7 +5390,7 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksMut<'a, T> { /// This struct is created by the [`chunks_exact`] method on [slices]. /// /// [`chunks_exact`]: ../../std/primitive.slice.html#method.chunks_exact -/// [`remainder`]: crate::slice::ChunksExact::remainder +/// [`remainder`]: ChunksExact::remainder /// [slices]: ../../std/primitive.slice.html #[derive(Debug)] #[stable(feature = "chunks_exact", since = "1.31.0")] @@ -5530,7 +5530,7 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksExact<'a, T> { /// This struct is created by the [`chunks_exact_mut`] method on [slices]. /// /// [`chunks_exact_mut`]: ../../std/primitive.slice.html#method.chunks_exact_mut -/// [`into_remainder`]: crate::slice::ChunksExactMut::into_remainder +/// [`into_remainder`]: ChunksExactMut::into_remainder /// [slices]: ../../std/primitive.slice.html #[derive(Debug)] #[stable(feature = "chunks_exact", since = "1.31.0")] @@ -5667,7 +5667,7 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksExactMut<'a, T> { /// This struct is created by the [`array_chunks`] method on [slices]. /// /// [`array_chunks`]: ../../std/primitive.slice.html#method.array_chunks -/// [`remainder`]: crate::slice::ArrayChunks::remainder +/// [`remainder`]: ArrayChunks::remainder /// [slices]: ../../std/primitive.slice.html #[derive(Debug)] #[unstable(feature = "array_chunks", issue = "74985")] @@ -6072,7 +6072,7 @@ unsafe impl<'a, T> TrustedRandomAccess for RChunksMut<'a, T> { /// This struct is created by the [`rchunks_exact`] method on [slices]. /// /// [`rchunks_exact`]: ../../std/primitive.slice.html#method.rchunks_exact -/// [`remainder`]: crate::slice::ChunksExact::remainder +/// [`remainder`]: ChunksExact::remainder /// [slices]: ../../std/primitive.slice.html #[derive(Debug)] #[stable(feature = "rchunks", since = "1.31.0")] @@ -6217,7 +6217,7 @@ unsafe impl<'a, T> TrustedRandomAccess for RChunksExact<'a, T> { /// This struct is created by the [`rchunks_exact_mut`] method on [slices]. /// /// [`rchunks_exact_mut`]: ../../std/primitive.slice.html#method.rchunks_exact_mut -/// [`into_remainder`]: crate::slice::ChunksExactMut::into_remainder +/// [`into_remainder`]: ChunksExactMut::into_remainder /// [slices]: ../../std/primitive.slice.html #[derive(Debug)] #[stable(feature = "rchunks", since = "1.31.0")] @@ -6470,7 +6470,6 @@ pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] { /// [valid]: ../../std/ptr/index.html#safety /// [`NonNull::dangling()`]: ../../std/ptr/struct.NonNull.html#method.dangling /// [`pointer::offset`]: ../../std/primitive.pointer.html#method.offset -/// [`from_raw_parts`]: crate::slice::from_raw_parts #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T] { From a04e12002a0c86a099f8ee8d84a755897535d857 Mon Sep 17 00:00:00 2001 From: Amjad Alsharafi Date: Wed, 26 Aug 2020 22:05:26 +0800 Subject: [PATCH 3/5] Used intra-doc links for `NonNull::dangling()` occurrences --- library/core/src/slice/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 762100bab94fb..5a93e7b12f497 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -6428,7 +6428,7 @@ unsafe impl<'a, T> TrustedRandomAccess for RChunksExactMut<'a, T> { /// ``` /// /// [valid]: ../../std/ptr/index.html#safety -/// [`NonNull::dangling()`]: ../../std/ptr/struct.NonNull.html#method.dangling +/// [`NonNull::dangling()`]: crate::ptr::NonNull::dangling /// [`pointer::offset`]: ../../std/primitive.pointer.html#method.offset #[inline] #[stable(feature = "rust1", since = "1.0.0")] @@ -6468,7 +6468,7 @@ pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] { /// See the safety documentation of [`pointer::offset`]. /// /// [valid]: ../../std/ptr/index.html#safety -/// [`NonNull::dangling()`]: ../../std/ptr/struct.NonNull.html#method.dangling +/// [`NonNull::dangling()`]: crate::ptr::NonNull::dangling /// [`pointer::offset`]: ../../std/primitive.pointer.html#method.offset #[inline] #[stable(feature = "rust1", since = "1.0.0")] From 6aae4a2fe68f0025d0bae0e97e614bfd3540eb97 Mon Sep 17 00:00:00 2001 From: Amjad Alsharafi Date: Wed, 26 Aug 2020 22:13:20 +0800 Subject: [PATCH 4/5] Used intra-doc links for `ptr#safety` occurrences --- library/core/src/slice/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 5a93e7b12f497..a7c6c53722a3f 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -6427,7 +6427,7 @@ unsafe impl<'a, T> TrustedRandomAccess for RChunksExactMut<'a, T> { /// } /// ``` /// -/// [valid]: ../../std/ptr/index.html#safety +/// [valid]: crate::ptr#safety /// [`NonNull::dangling()`]: crate::ptr::NonNull::dangling /// [`pointer::offset`]: ../../std/primitive.pointer.html#method.offset #[inline] @@ -6467,7 +6467,7 @@ pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] { /// * The total size `len * mem::size_of::()` of the slice must be no larger than `isize::MAX`. /// See the safety documentation of [`pointer::offset`]. /// -/// [valid]: ../../std/ptr/index.html#safety +/// [valid]: crate::ptr#safety /// [`NonNull::dangling()`]: crate::ptr::NonNull::dangling /// [`pointer::offset`]: ../../std/primitive.pointer.html#method.offset #[inline] From 300a0072a27f9c2d64ea63cea3b15463383683b0 Mon Sep 17 00:00:00 2001 From: Amjad Alsharafi Date: Sun, 30 Aug 2020 15:22:27 +0800 Subject: [PATCH 5/5] Fix intra-doc path resolution problem in `library/alloc/src/slice.rs` `alloc::slice` uses `core::slice` functions, documentation are copied from there and the links as well without resolution. `crate::ptr...` cannot be resolved in `alloc::slice`, but `ptr` itself is imported in both `alloc::slice` and `core::slice`, so we used that instead. --- library/core/src/slice/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index a7c6c53722a3f..7de382b366cf7 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -6427,8 +6427,8 @@ unsafe impl<'a, T> TrustedRandomAccess for RChunksExactMut<'a, T> { /// } /// ``` /// -/// [valid]: crate::ptr#safety -/// [`NonNull::dangling()`]: crate::ptr::NonNull::dangling +/// [valid]: ptr#safety +/// [`NonNull::dangling()`]: ptr::NonNull::dangling /// [`pointer::offset`]: ../../std/primitive.pointer.html#method.offset #[inline] #[stable(feature = "rust1", since = "1.0.0")] @@ -6467,8 +6467,8 @@ pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] { /// * The total size `len * mem::size_of::()` of the slice must be no larger than `isize::MAX`. /// See the safety documentation of [`pointer::offset`]. /// -/// [valid]: crate::ptr#safety -/// [`NonNull::dangling()`]: crate::ptr::NonNull::dangling +/// [valid]: ptr#safety +/// [`NonNull::dangling()`]: ptr::NonNull::dangling /// [`pointer::offset`]: ../../std/primitive.pointer.html#method.offset #[inline] #[stable(feature = "rust1", since = "1.0.0")]