Skip to content

Commit 59a1a05

Browse files
committed
Convert many files to intra-doc links
- Use intra-doc links for `std::io` in `std::fs` - Use intra-doc links for File::read in unix/ext/fs.rs - Remove explicit intra-doc links for `true` in `net/addr.rs` - Use intra-doc links in alloc/src/sync.rs - Use intra-doc links in src/ascii.rs - Switch to intra-doc links in alloc/rc.rs - Use intra-doc links in core/pin.rs - Use intra-doc links in std/prelude - Use shorter links in `std/fs.rs` `io` is already in scope.
1 parent 726b187 commit 59a1a05

File tree

8 files changed

+34
-37
lines changed

8 files changed

+34
-37
lines changed

library/alloc/src/rc.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ impl<T> Rc<T> {
376376
/// assert_eq!(*zero, 0)
377377
/// ```
378378
///
379-
/// [zeroed]: ../../std/mem/union.MaybeUninit.html#method.zeroed
379+
/// [zeroed]: mem::MaybeUninit::zeroed
380380
#[unstable(feature = "new_uninit", issue = "63291")]
381381
pub fn new_zeroed() -> Rc<mem::MaybeUninit<T>> {
382382
unsafe {
@@ -484,7 +484,7 @@ impl<T> Rc<[T]> {
484484
/// assert_eq!(*values, [0, 0, 0])
485485
/// ```
486486
///
487-
/// [zeroed]: ../../std/mem/union.MaybeUninit.html#method.zeroed
487+
/// [zeroed]: mem::MaybeUninit::zeroed
488488
#[unstable(feature = "new_uninit", issue = "63291")]
489489
pub fn new_zeroed_slice(len: usize) -> Rc<[mem::MaybeUninit<T>]> {
490490
unsafe {
@@ -511,7 +511,7 @@ impl<T> Rc<mem::MaybeUninit<T>> {
511511
/// Calling this when the content is not yet fully initialized
512512
/// causes immediate undefined behavior.
513513
///
514-
/// [`MaybeUninit::assume_init`]: ../../std/mem/union.MaybeUninit.html#method.assume_init
514+
/// [`MaybeUninit::assume_init`]: mem::MaybeUninit::assume_init
515515
///
516516
/// # Examples
517517
///
@@ -550,7 +550,7 @@ impl<T> Rc<[mem::MaybeUninit<T>]> {
550550
/// Calling this when the content is not yet fully initialized
551551
/// causes immediate undefined behavior.
552552
///
553-
/// [`MaybeUninit::assume_init`]: ../../std/mem/union.MaybeUninit.html#method.assume_init
553+
/// [`MaybeUninit::assume_init`]: mem::MaybeUninit::assume_init
554554
///
555555
/// # Examples
556556
///

library/alloc/src/sync.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ macro_rules! acquire {
152152
/// [upgrade]: Weak::upgrade
153153
/// [`RefCell<T>`]: core::cell::RefCell
154154
/// [`std::sync`]: ../../std/sync/index.html
155-
/// [`Arc::clone(&from)`]: #method.clone
155+
/// [`Arc::clone(&from)`]: Arc::clone
156156
///
157157
/// # Examples
158158
///
@@ -201,7 +201,7 @@ macro_rules! acquire {
201201
/// See the [`rc` documentation][rc_examples] for more examples of reference
202202
/// counting in general.
203203
///
204-
/// [rc_examples]: ../../std/rc/index.html#examples
204+
/// [rc_examples]: crate::rc#examples
205205
#[cfg_attr(not(test), rustc_diagnostic_item = "Arc")]
206206
#[stable(feature = "rust1", since = "1.0.0")]
207207
pub struct Arc<T: ?Sized> {
@@ -443,7 +443,7 @@ impl<T> Arc<T> {
443443
/// assert_eq!(*zero, 0)
444444
/// ```
445445
///
446-
/// [zeroed]: ../../std/mem/union.MaybeUninit.html#method.zeroed
446+
/// [zeroed]: mem::MaybeUninit::zeroed
447447
#[unstable(feature = "new_uninit", issue = "63291")]
448448
pub fn new_zeroed() -> Arc<mem::MaybeUninit<T>> {
449449
unsafe {
@@ -550,7 +550,7 @@ impl<T> Arc<[T]> {
550550
/// assert_eq!(*values, [0, 0, 0])
551551
/// ```
552552
///
553-
/// [zeroed]: ../../std/mem/union.MaybeUninit.html#method.zeroed
553+
/// [zeroed]: mem::MaybeUninit::zeroed
554554
#[unstable(feature = "new_uninit", issue = "63291")]
555555
pub fn new_zeroed_slice(len: usize) -> Arc<[mem::MaybeUninit<T>]> {
556556
unsafe {
@@ -577,7 +577,7 @@ impl<T> Arc<mem::MaybeUninit<T>> {
577577
/// Calling this when the content is not yet fully initialized
578578
/// causes immediate undefined behavior.
579579
///
580-
/// [`MaybeUninit::assume_init`]: ../../std/mem/union.MaybeUninit.html#method.assume_init
580+
/// [`MaybeUninit::assume_init`]: mem::MaybeUninit::method.assume_init
581581
///
582582
/// # Examples
583583
///
@@ -616,7 +616,7 @@ impl<T> Arc<[mem::MaybeUninit<T>]> {
616616
/// Calling this when the content is not yet fully initialized
617617
/// causes immediate undefined behavior.
618618
///
619-
/// [`MaybeUninit::assume_init`]: ../../std/mem/union.MaybeUninit.html#method.assume_init
619+
/// [`MaybeUninit::assume_init`]: mem::MaybeUninit::method.assume_init
620620
///
621621
/// # Examples
622622
///

library/core/src/pin.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
661661
/// because it is one of the fields of that value), and also that you do
662662
/// not move out of the argument you receive to the interior function.
663663
///
664-
/// [`pin` module]: ../../std/pin/index.html#projections-and-structural-pinning
664+
/// [`pin` module]: self#projections-and-structural-pinning
665665
#[stable(feature = "pin", since = "1.33.0")]
666666
pub unsafe fn map_unchecked<U, F>(self, func: F) -> Pin<&'a U>
667667
where
@@ -692,7 +692,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
692692
/// the `Pin` itself. This method allows turning the `Pin` into a reference
693693
/// with the same lifetime as the original `Pin`.
694694
///
695-
/// ["pinning projections"]: ../../std/pin/index.html#projections-and-structural-pinning
695+
/// ["pinning projections"]: self#projections-and-structural-pinning
696696
#[stable(feature = "pin", since = "1.33.0")]
697697
#[inline(always)]
698698
pub fn get_ref(self) -> &'a T {
@@ -756,7 +756,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
756756
/// because it is one of the fields of that value), and also that you do
757757
/// not move out of the argument you receive to the interior function.
758758
///
759-
/// [`pin` module]: ../../std/pin/index.html#projections-and-structural-pinning
759+
/// [`pin` module]: self#projections-and-structural-pinning
760760
#[stable(feature = "pin", since = "1.33.0")]
761761
pub unsafe fn map_unchecked_mut<U, F>(self, func: F) -> Pin<&'a mut U>
762762
where

library/std/src/ascii.rs

-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ pub trait AsciiExt {
7070
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
7171
///
7272
/// [`make_ascii_uppercase`]: AsciiExt::make_ascii_uppercase
73-
/// [`str::to_uppercase`]: ../primitive.str.html#method.to_uppercase
7473
#[stable(feature = "rust1", since = "1.0.0")]
7574
#[allow(deprecated)]
7675
fn to_ascii_uppercase(&self) -> Self::Owned;
@@ -91,7 +90,6 @@ pub trait AsciiExt {
9190
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
9291
///
9392
/// [`make_ascii_lowercase`]: AsciiExt::make_ascii_lowercase
94-
/// [`str::to_lowercase`]: ../primitive.str.html#method.to_lowercase
9593
#[stable(feature = "rust1", since = "1.0.0")]
9694
#[allow(deprecated)]
9795
fn to_ascii_lowercase(&self) -> Self::Owned;

library/std/src/fs.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ impl File {
553553
/// the `SetFileInformationByHandle` function on Windows. Note that, this
554554
/// [may change in the future][changes].
555555
///
556-
/// [changes]: ../io/index.html#platform-specific-behavior
556+
/// [changes]: io#platform-specific-behavior
557557
///
558558
/// # Errors
559559
///
@@ -1503,7 +1503,7 @@ impl AsInner<fs_imp::DirEntry> for DirEntry {
15031503
/// and the `DeleteFile` function on Windows.
15041504
/// Note that, this [may change in the future][changes].
15051505
///
1506-
/// [changes]: ../io/index.html#platform-specific-behavior
1506+
/// [changes]: io#platform-specific-behavior
15071507
///
15081508
/// # Errors
15091509
///
@@ -1541,7 +1541,7 @@ pub fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> {
15411541
/// and the `GetFileAttributesEx` function on Windows.
15421542
/// Note that, this [may change in the future][changes].
15431543
///
1544-
/// [changes]: ../io/index.html#platform-specific-behavior
1544+
/// [changes]: io#platform-specific-behavior
15451545
///
15461546
/// # Errors
15471547
///
@@ -1575,7 +1575,7 @@ pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
15751575
/// and the `GetFileAttributesEx` function on Windows.
15761576
/// Note that, this [may change in the future][changes].
15771577
///
1578-
/// [changes]: ../io/index.html#platform-specific-behavior
1578+
/// [changes]: io#platform-specific-behavior
15791579
///
15801580
/// # Errors
15811581
///
@@ -1618,7 +1618,7 @@ pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
16181618
///
16191619
/// Note that, this [may change in the future][changes].
16201620
///
1621-
/// [changes]: ../io/index.html#platform-specific-behavior
1621+
/// [changes]: io#platform-specific-behavior
16221622
///
16231623
/// # Errors
16241624
///
@@ -1669,7 +1669,7 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()>
16691669
/// `fcopyfile`.
16701670
/// Note that, this [may change in the future][changes].
16711671
///
1672-
/// [changes]: ../io/index.html#platform-specific-behavior
1672+
/// [changes]: io#platform-specific-behavior
16731673
///
16741674
/// # Errors
16751675
///
@@ -1707,7 +1707,7 @@ pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<u64> {
17071707
/// and the `CreateHardLink` function on Windows.
17081708
/// Note that, this [may change in the future][changes].
17091709
///
1710-
/// [changes]: ../io/index.html#platform-specific-behavior
1710+
/// [changes]: io#platform-specific-behavior
17111711
///
17121712
/// # Errors
17131713
///
@@ -1772,7 +1772,7 @@ pub fn soft_link<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<(
17721772
/// `FILE_FLAG_BACKUP_SEMANTICS` flags on Windows.
17731773
/// Note that, this [may change in the future][changes].
17741774
///
1775-
/// [changes]: ../io/index.html#platform-specific-behavior
1775+
/// [changes]: io#platform-specific-behavior
17761776
///
17771777
/// # Errors
17781778
///
@@ -1812,7 +1812,7 @@ pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
18121812
/// with other applications (if passed to the application on the command-line,
18131813
/// or written to a file another application may read).
18141814
///
1815-
/// [changes]: ../io/index.html#platform-specific-behavior
1815+
/// [changes]: io#platform-specific-behavior
18161816
/// [path]: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
18171817
///
18181818
/// # Errors
@@ -1846,7 +1846,7 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
18461846
/// and the `CreateDirectory` function on Windows.
18471847
/// Note that, this [may change in the future][changes].
18481848
///
1849-
/// [changes]: ../io/index.html#platform-specific-behavior
1849+
/// [changes]: io#platform-specific-behavior
18501850
///
18511851
/// **NOTE**: If a parent of the given path doesn't exist, this function will
18521852
/// return an error. To create a directory and all its missing parents at the
@@ -1887,7 +1887,7 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
18871887
/// and the `CreateDirectory` function on Windows.
18881888
/// Note that, this [may change in the future][changes].
18891889
///
1890-
/// [changes]: ../io/index.html#platform-specific-behavior
1890+
/// [changes]: io#platform-specific-behavior
18911891
///
18921892
/// # Errors
18931893
///
@@ -1930,7 +1930,7 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
19301930
/// and the `RemoveDirectory` function on Windows.
19311931
/// Note that, this [may change in the future][changes].
19321932
///
1933-
/// [changes]: ../io/index.html#platform-specific-behavior
1933+
/// [changes]: io#platform-specific-behavior
19341934
///
19351935
/// # Errors
19361936
///
@@ -1970,7 +1970,7 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
19701970
/// on Windows.
19711971
/// Note that, this [may change in the future][changes].
19721972
///
1973-
/// [changes]: ../io/index.html#platform-specific-behavior
1973+
/// [changes]: io#platform-specific-behavior
19741974
///
19751975
/// # Errors
19761976
///
@@ -2006,7 +2006,7 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
20062006
/// currently corresponds to `readdir` on Unix and `FindNextFile` on Windows.
20072007
/// Note that, this [may change in the future][changes].
20082008
///
2009-
/// [changes]: ../io/index.html#platform-specific-behavior
2009+
/// [changes]: io#platform-specific-behavior
20102010
///
20112011
/// The order in which this iterator returns entries is platform and filesystem
20122012
/// dependent.
@@ -2075,7 +2075,7 @@ pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
20752075
/// and the `SetFileAttributes` function on Windows.
20762076
/// Note that, this [may change in the future][changes].
20772077
///
2078-
/// [changes]: ../io/index.html#platform-specific-behavior
2078+
/// [changes]: io#platform-specific-behavior
20792079
///
20802080
/// # Errors
20812081
///

library/std/src/net/addr.rs

-4
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ impl SocketAddr {
213213
///
214214
/// [IP address]: IpAddr
215215
/// [`IPv4` address]: IpAddr::V4
216-
/// [`false`]: ../../std/primitive.bool.html
217-
/// [`true`]: ../../std/primitive.bool.html
218216
///
219217
/// # Examples
220218
///
@@ -235,8 +233,6 @@ impl SocketAddr {
235233
///
236234
/// [IP address]: IpAddr
237235
/// [`IPv6` address]: IpAddr::V6
238-
/// [`false`]: ../../std/primitive.bool.html
239-
/// [`true`]: ../../std/primitive.bool.html
240236
///
241237
/// # Examples
242238
///

library/std/src/prelude/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
//! [`std::result`]: crate::result
7676
//! [`std::slice`]: crate::slice
7777
//! [`std::string`]: crate::string
78-
//! [`std::vec`]: ../vec/index.html
78+
//! [`std::vec`]: crate::vec!
7979
//! [`to_owned`]: crate::borrow::ToOwned::to_owned
8080
//! [book-closures]: ../../book/ch13-01-closures.html
8181
//! [book-dtor]: ../../book/ch15-03-drop.html

library/std/src/sys/unix/ext/fs.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ use crate::path::Path;
88
use crate::sys;
99
use crate::sys::platform::fs::MetadataExt as UnixMetadataExt;
1010
use crate::sys_common::{AsInner, AsInnerMut, FromInner};
11+
// Used for `File::read` on intra-doc links
12+
#[allow(unused_imports)]
13+
use io::{Read, Write};
1114

1215
/// Unix-specific extensions to [`fs::File`].
1316
#[stable(feature = "file_offset", since = "1.15.0")]
@@ -24,7 +27,7 @@ pub trait FileExt {
2427
/// Note that similar to [`File::read`], it is not an error to return with a
2528
/// short read.
2629
///
27-
/// [`File::read`]: ../../../../std/fs/struct.File.html#method.read
30+
/// [`File::read`]: fs::File::read
2831
///
2932
/// # Examples
3033
///
@@ -127,7 +130,7 @@ pub trait FileExt {
127130
/// Note that similar to [`File::write`], it is not an error to return a
128131
/// short write.
129132
///
130-
/// [`File::write`]: ../../../../std/fs/struct.File.html#method.write
133+
/// [`File::write`]: fs::File::write
131134
///
132135
/// # Examples
133136
///

0 commit comments

Comments
 (0)