Skip to content

Commit 07ea340

Browse files
authored
Rollup merge of #75685 - nixphix:docs/unix-ext, r=jyn514
Switch to intra-doc links in /src/sys/unix/ext/*.rs Partial fix for #75080 @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc r? @jyn514 These two links are not resolving to either `crate::fs::File...` or `fs::File...` ``` # unix/ext/fs.rs 27: /// [`File::read`]: ../../../../std/fs/struct.File.html#method.read 130: /// [`File::write`]: ../../../../std/fs/struct.File.html#method.write ```
2 parents 98f7d88 + 63d2e9b commit 07ea340

File tree

4 files changed

+26
-76
lines changed

4 files changed

+26
-76
lines changed

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

+13-32
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ use crate::sys;
99
use crate::sys::platform::fs::MetadataExt as UnixMetadataExt;
1010
use crate::sys_common::{AsInner, AsInnerMut, FromInner};
1111

12-
/// Unix-specific extensions to [`File`].
13-
///
14-
/// [`File`]: ../../../../std/fs/struct.File.html
12+
/// Unix-specific extensions to [`fs::File`].
1513
#[stable(feature = "file_offset", since = "1.15.0")]
1614
pub trait FileExt {
1715
/// Reads a number of bytes starting from a given offset.
@@ -55,19 +53,18 @@ pub trait FileExt {
5553
///
5654
/// The current file cursor is not affected by this function.
5755
///
58-
/// Similar to [`Read::read_exact`] but uses [`read_at`] instead of `read`.
56+
/// Similar to [`io::Read::read_exact`] but uses [`read_at`] instead of `read`.
5957
///
60-
/// [`Read::read_exact`]: ../../../../std/io/trait.Read.html#method.read_exact
61-
/// [`read_at`]: #tymethod.read_at
58+
/// [`read_at`]: FileExt::read_at
6259
///
6360
/// # Errors
6461
///
6562
/// If this function encounters an error of the kind
66-
/// [`ErrorKind::Interrupted`] then the error is ignored and the operation
63+
/// [`io::ErrorKind::Interrupted`] then the error is ignored and the operation
6764
/// will continue.
6865
///
6966
/// If this function encounters an "end of file" before completely filling
70-
/// the buffer, it returns an error of the kind [`ErrorKind::UnexpectedEof`].
67+
/// the buffer, it returns an error of the kind [`io::ErrorKind::UnexpectedEof`].
7168
/// The contents of `buf` are unspecified in this case.
7269
///
7370
/// If any other read error is encountered then this function immediately
@@ -77,9 +74,6 @@ pub trait FileExt {
7774
/// has read, but it will never read more than would be necessary to
7875
/// completely fill the buffer.
7976
///
80-
/// [`ErrorKind::Interrupted`]: ../../../../std/io/enum.ErrorKind.html#variant.Interrupted
81-
/// [`ErrorKind::UnexpectedEof`]: ../../../../std/io/enum.ErrorKind.html#variant.UnexpectedEof
82-
///
8377
/// # Examples
8478
///
8579
/// ```no_run
@@ -161,19 +155,18 @@ pub trait FileExt {
161155
/// The current file cursor is not affected by this function.
162156
///
163157
/// This method will continuously call [`write_at`] until there is no more data
164-
/// to be written or an error of non-[`ErrorKind::Interrupted`] kind is
158+
/// to be written or an error of non-[`io::ErrorKind::Interrupted`] kind is
165159
/// returned. This method will not return until the entire buffer has been
166160
/// successfully written or such an error occurs. The first error that is
167-
/// not of [`ErrorKind::Interrupted`] kind generated from this method will be
161+
/// not of [`io::ErrorKind::Interrupted`] kind generated from this method will be
168162
/// returned.
169163
///
170164
/// # Errors
171165
///
172166
/// This function will return the first error of
173-
/// non-[`ErrorKind::Interrupted`] kind that [`write_at`] returns.
167+
/// non-[`io::ErrorKind::Interrupted`] kind that [`write_at`] returns.
174168
///
175-
/// [`ErrorKind::Interrupted`]: ../../../../std/io/enum.ErrorKind.html#variant.Interrupted
176-
/// [`write_at`]: #tymethod.write_at
169+
/// [`write_at`]: FileExt::write_at
177170
///
178171
/// # Examples
179172
///
@@ -223,8 +216,6 @@ impl FileExt for fs::File {
223216
}
224217

225218
/// Unix-specific extensions to [`fs::Permissions`].
226-
///
227-
/// [`fs::Permissions`]: ../../../../std/fs/struct.Permissions.html
228219
#[stable(feature = "fs_ext", since = "1.1.0")]
229220
pub trait PermissionsExt {
230221
/// Returns the underlying raw `st_mode` bits that contain the standard
@@ -302,8 +293,6 @@ impl PermissionsExt for Permissions {
302293
}
303294

304295
/// Unix-specific extensions to [`fs::OpenOptions`].
305-
///
306-
/// [`fs::OpenOptions`]: ../../../../std/fs/struct.OpenOptions.html
307296
#[stable(feature = "fs_ext", since = "1.1.0")]
308297
pub trait OpenOptionsExt {
309298
/// Sets the mode bits that a new file will be created with.
@@ -372,8 +361,6 @@ impl OpenOptionsExt for OpenOptions {
372361
}
373362

374363
/// Unix-specific extensions to [`fs::Metadata`].
375-
///
376-
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
377364
#[stable(feature = "metadata_ext", since = "1.1.0")]
378365
pub trait MetadataExt {
379366
/// Returns the ID of the device containing the file.
@@ -535,7 +522,7 @@ pub trait MetadataExt {
535522
fn atime(&self) -> i64;
536523
/// Returns the last access time of the file, in nanoseconds since [`atime`].
537524
///
538-
/// [`atime`]: #tymethod.atime
525+
/// [`atime`]: MetadataExt::atime
539526
///
540527
/// # Examples
541528
///
@@ -571,7 +558,7 @@ pub trait MetadataExt {
571558
fn mtime(&self) -> i64;
572559
/// Returns the last modification time of the file, in nanoseconds since [`mtime`].
573560
///
574-
/// [`mtime`]: #tymethod.mtime
561+
/// [`mtime`]: MetadataExt::mtime
575562
///
576563
/// # Examples
577564
///
@@ -607,7 +594,7 @@ pub trait MetadataExt {
607594
fn ctime(&self) -> i64;
608595
/// Returns the last status change time of the file, in nanoseconds since [`ctime`].
609596
///
610-
/// [`ctime`]: #tymethod.ctime
597+
/// [`ctime`]: MetadataExt::ctime
611598
///
612599
/// # Examples
613600
///
@@ -714,12 +701,10 @@ impl MetadataExt for fs::Metadata {
714701
}
715702
}
716703

717-
/// Unix-specific extensions for [`FileType`].
704+
/// Unix-specific extensions for [`fs::FileType`].
718705
///
719706
/// Adds support for special Unix file types such as block/character devices,
720707
/// pipes, and sockets.
721-
///
722-
/// [`FileType`]: ../../../../std/fs/struct.FileType.html
723708
#[stable(feature = "file_type_ext", since = "1.5.0")]
724709
pub trait FileTypeExt {
725710
/// Returns `true` if this file type is a block device.
@@ -813,8 +798,6 @@ impl FileTypeExt for fs::FileType {
813798
}
814799

815800
/// Unix-specific extension methods for [`fs::DirEntry`].
816-
///
817-
/// [`fs::DirEntry`]: ../../../../std/fs/struct.DirEntry.html
818801
#[stable(feature = "dir_entry_ext", since = "1.1.0")]
819802
pub trait DirEntryExt {
820803
/// Returns the underlying `d_ino` field in the contained `dirent`
@@ -875,8 +858,6 @@ pub fn symlink<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()>
875858
}
876859

877860
/// Unix-specific extensions to [`fs::DirBuilder`].
878-
///
879-
/// [`fs::DirBuilder`]: ../../../../std/fs/struct.DirBuilder.html
880861
#[stable(feature = "dir_builder", since = "1.6.0")]
881862
pub trait DirBuilderExt {
882863
/// Sets the mode to create new directories with. This option defaults to

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

+11-34
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,7 @@ impl UnixStream {
408408
/// indefinitely. An [`Err`] is returned if the zero [`Duration`] is passed to this
409409
/// method.
410410
///
411-
/// [`None`]: ../../../../std/option/enum.Option.html#variant.None
412-
/// [`Err`]: ../../../../std/result/enum.Result.html#variant.Err
413-
/// [`read`]: ../../../../std/io/trait.Read.html#tymethod.read
414-
/// [`Duration`]: ../../../../std/time/struct.Duration.html
411+
/// [`read`]: io::Read::read
415412
///
416413
/// # Examples
417414
///
@@ -453,10 +450,7 @@ impl UnixStream {
453450
/// indefinitely. An [`Err`] is returned if the zero [`Duration`] is
454451
/// passed to this method.
455452
///
456-
/// [`None`]: ../../../../std/option/enum.Option.html#variant.None
457-
/// [`Err`]: ../../../../std/result/enum.Result.html#variant.Err
458-
/// [`write`]: ../../../../std/io/trait.Write.html#tymethod.write
459-
/// [`Duration`]: ../../../../std/time/struct.Duration.html
453+
/// [`read`]: io::Read::read
460454
///
461455
/// # Examples
462456
///
@@ -581,8 +575,6 @@ impl UnixStream {
581575
/// specified portions to immediately return with an appropriate value
582576
/// (see the documentation of [`Shutdown`]).
583577
///
584-
/// [`Shutdown`]: ../../../../std/net/enum.Shutdown.html
585-
///
586578
/// # Examples
587579
///
588580
/// ```no_run
@@ -852,7 +844,7 @@ impl UnixListener {
852844
/// is established. When established, the corresponding [`UnixStream`] and
853845
/// the remote peer's address will be returned.
854846
///
855-
/// [`UnixStream`]: ../../../../std/os/unix/net/struct.UnixStream.html
847+
/// [`UnixStream`]: crate::os::unix::net::UnixStream
856848
///
857849
/// # Examples
858850
///
@@ -937,8 +929,6 @@ impl UnixListener {
937929
/// Ok(())
938930
/// }
939931
/// ```
940-
///
941-
/// [`io::ErrorKind::WouldBlock`]: ../../../io/enum.ErrorKind.html#variant.WouldBlock
942932
#[stable(feature = "unix_socket", since = "1.10.0")]
943933
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
944934
self.0.set_nonblocking(nonblocking)
@@ -973,9 +963,6 @@ impl UnixListener {
973963
/// The iterator will never return [`None`] and will also not yield the
974964
/// peer's [`SocketAddr`] structure.
975965
///
976-
/// [`None`]: ../../../../std/option/enum.Option.html#variant.None
977-
/// [`SocketAddr`]: struct.SocketAddr.html
978-
///
979966
/// # Examples
980967
///
981968
/// ```no_run
@@ -1043,9 +1030,6 @@ impl<'a> IntoIterator for &'a UnixListener {
10431030
///
10441031
/// It will never return [`None`].
10451032
///
1046-
/// [`None`]: ../../../../std/option/enum.Option.html#variant.None
1047-
/// [`UnixListener`]: struct.UnixListener.html
1048-
///
10491033
/// # Examples
10501034
///
10511035
/// ```no_run
@@ -1205,9 +1189,9 @@ impl UnixDatagram {
12051189
/// The [`send`] method may be used to send data to the specified address.
12061190
/// [`recv`] and [`recv_from`] will only receive data from that address.
12071191
///
1208-
/// [`send`]: #method.send
1209-
/// [`recv`]: #method.recv
1210-
/// [`recv_from`]: #method.recv_from
1192+
/// [`send`]: UnixDatagram::send
1193+
/// [`recv`]: UnixDatagram::recv
1194+
/// [`recv_from`]: UnixDatagram::recv_from
12111195
///
12121196
/// # Examples
12131197
///
@@ -1284,7 +1268,7 @@ impl UnixDatagram {
12841268
///
12851269
/// The [`connect`] method will connect the socket to a peer.
12861270
///
1287-
/// [`connect`]: #method.connect
1271+
/// [`connect`]: UnixDatagram::connect
12881272
///
12891273
/// # Examples
12901274
///
@@ -1432,11 +1416,8 @@ impl UnixDatagram {
14321416
/// block indefinitely. An [`Err`] is returned if the zero [`Duration`]
14331417
/// is passed to this method.
14341418
///
1435-
/// [`None`]: ../../../../std/option/enum.Option.html#variant.None
1436-
/// [`Err`]: ../../../../std/result/enum.Result.html#variant.Err
1437-
/// [`recv`]: #method.recv
1438-
/// [`recv_from`]: #method.recv_from
1439-
/// [`Duration`]: ../../../../std/time/struct.Duration.html
1419+
/// [`recv`]: UnixDatagram::recv
1420+
/// [`recv_from`]: UnixDatagram::recv_from
14401421
///
14411422
/// # Examples
14421423
///
@@ -1479,10 +1460,8 @@ impl UnixDatagram {
14791460
/// block indefinitely. An [`Err`] is returned if the zero [`Duration`] is passed to this
14801461
/// method.
14811462
///
1482-
/// [`None`]: ../../../../std/option/enum.Option.html#variant.None
1483-
/// [`send`]: #method.send
1484-
/// [`send_to`]: #method.send_to
1485-
/// [`Duration`]: ../../../../std/time/struct.Duration.html
1463+
/// [`send`]: UnixDatagram::send
1464+
/// [`send_to`]: UnixDatagram::send_to
14861465
///
14871466
/// # Examples
14881467
///
@@ -1605,8 +1584,6 @@ impl UnixDatagram {
16051584
/// specified portions to immediately return with an appropriate value
16061585
/// (see the documentation of [`Shutdown`]).
16071586
///
1608-
/// [`Shutdown`]: ../../../../std/net/enum.Shutdown.html
1609-
///
16101587
/// ```no_run
16111588
/// use std::os::unix::net::UnixDatagram;
16121589
/// use std::net::Shutdown;

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

+1-7
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ use crate::sys;
1010
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
1111

1212
/// Unix-specific extensions to the [`process::Command`] builder.
13-
///
14-
/// [`process::Command`]: ../../../../std/process/struct.Command.html
1513
#[stable(feature = "rust1", since = "1.0.0")]
1614
pub trait CommandExt {
1715
/// Sets the child process's user ID. This translates to a
@@ -65,7 +63,7 @@ pub trait CommandExt {
6563
/// This method is stable and usable, but it should be unsafe. To fix
6664
/// that, it got deprecated in favor of the unsafe [`pre_exec`].
6765
///
68-
/// [`pre_exec`]: #tymethod.pre_exec
66+
/// [`pre_exec`]: CommandExt::pre_exec
6967
#[stable(feature = "process_exec", since = "1.15.0")]
7068
#[rustc_deprecated(since = "1.37.0", reason = "should be unsafe, use `pre_exec` instead")]
7169
fn before_exec<F>(&mut self, f: F) -> &mut process::Command
@@ -94,8 +92,6 @@ pub trait CommandExt {
9492
/// a new child. Like spawn, however, the default behavior for the stdio
9593
/// descriptors will be to inherited from the current process.
9694
///
97-
/// [`process::exit`]: ../../../process/fn.exit.html
98-
///
9995
/// # Notes
10096
///
10197
/// The process may be in a "broken state" if this function returns in
@@ -151,8 +147,6 @@ impl CommandExt for process::Command {
151147
}
152148

153149
/// Unix-specific extensions to [`process::ExitStatus`].
154-
///
155-
/// [`process::ExitStatus`]: ../../../../std/process/struct.ExitStatus.html
156150
#[stable(feature = "rust1", since = "1.0.0")]
157151
pub trait ExitStatusExt {
158152
/// Creates a new `ExitStatus` from the raw underlying `i32` return value of

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ use crate::thread::JoinHandle;
1111
#[allow(deprecated)]
1212
pub type RawPthread = pthread_t;
1313

14-
/// Unix-specific extensions to [`thread::JoinHandle`].
15-
///
16-
/// [`thread::JoinHandle`]: ../../../../std/thread/struct.JoinHandle.html
14+
/// Unix-specific extensions to [`JoinHandle`].
1715
#[stable(feature = "thread_extensions", since = "1.9.0")]
1816
pub trait JoinHandleExt {
1917
/// Extracts the raw pthread_t without taking ownership

0 commit comments

Comments
 (0)