Skip to content

Commit 7a4fb35

Browse files
committed
Auto merge of #75567 - poliorcetics:intra-links-std-net, r=jyn514
Move to intra doc links in std::net Helps with #75080. @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc The links for `true` and `false` had to stay else `rustdoc` complained, it is intended ?
2 parents 97ba0c7 + 5fc187c commit 7a4fb35

File tree

6 files changed

+142
-293
lines changed

6 files changed

+142
-293
lines changed

library/std/src/net/addr.rs

+26-54
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ use crate::vec;
2222
/// The size of a `SocketAddr` instance may vary depending on the target operating
2323
/// system.
2424
///
25-
/// [IP address]: ../../std/net/enum.IpAddr.html
26-
/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html
27-
/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html
25+
/// [IP address]: IpAddr
2826
///
2927
/// # Examples
3028
///
@@ -50,7 +48,7 @@ pub enum SocketAddr {
5048

5149
/// An IPv4 socket address.
5250
///
53-
/// IPv4 socket addresses consist of an [IPv4 address] and a 16-bit port number, as
51+
/// IPv4 socket addresses consist of an [`IPv4` address] and a 16-bit port number, as
5452
/// stated in [IETF RFC 793].
5553
///
5654
/// See [`SocketAddr`] for a type encompassing both IPv4 and IPv6 socket addresses.
@@ -59,8 +57,7 @@ pub enum SocketAddr {
5957
/// system.
6058
///
6159
/// [IETF RFC 793]: https://tools.ietf.org/html/rfc793
62-
/// [IPv4 address]: ../../std/net/struct.Ipv4Addr.html
63-
/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html
60+
/// [`IPv4` address]: Ipv4Addr
6461
///
6562
/// # Examples
6663
///
@@ -81,7 +78,7 @@ pub struct SocketAddrV4 {
8178

8279
/// An IPv6 socket address.
8380
///
84-
/// IPv6 socket addresses consist of an [Ipv6 address], a 16-bit port number, as well
81+
/// IPv6 socket addresses consist of an [`IPv6` address], a 16-bit port number, as well
8582
/// as fields containing the traffic class, the flow label, and a scope identifier
8683
/// (see [IETF RFC 2553, Section 3.3] for more details).
8784
///
@@ -91,8 +88,7 @@ pub struct SocketAddrV4 {
9188
/// system.
9289
///
9390
/// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3
94-
/// [IPv6 address]: ../../std/net/struct.Ipv6Addr.html
95-
/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html
91+
/// [`IPv6` address]: Ipv6Addr
9692
///
9793
/// # Examples
9894
///
@@ -114,7 +110,7 @@ pub struct SocketAddrV6 {
114110
impl SocketAddr {
115111
/// Creates a new socket address from an [IP address] and a port number.
116112
///
117-
/// [IP address]: ../../std/net/enum.IpAddr.html
113+
/// [IP address]: IpAddr
118114
///
119115
/// # Examples
120116
///
@@ -210,12 +206,12 @@ impl SocketAddr {
210206
}
211207

212208
/// Returns [`true`] if the [IP address] in this `SocketAddr` is an
213-
/// [IPv4 address], and [`false`] otherwise.
209+
/// [`IPv4` address], and [`false`] otherwise.
214210
///
215-
/// [`true`]: ../../std/primitive.bool.html
211+
/// [IP address]: IpAddr
212+
/// [`IPv4` address]: IpAddr::V4
216213
/// [`false`]: ../../std/primitive.bool.html
217-
/// [IP address]: ../../std/net/enum.IpAddr.html
218-
/// [IPv4 address]: ../../std/net/enum.IpAddr.html#variant.V4
214+
/// [`true`]: ../../std/primitive.bool.html
219215
///
220216
/// # Examples
221217
///
@@ -232,12 +228,12 @@ impl SocketAddr {
232228
}
233229

234230
/// Returns [`true`] if the [IP address] in this `SocketAddr` is an
235-
/// [IPv6 address], and [`false`] otherwise.
231+
/// [`IPv6` address], and [`false`] otherwise.
236232
///
237-
/// [`true`]: ../../std/primitive.bool.html
233+
/// [IP address]: IpAddr
234+
/// [`IPv6` address]: IpAddr::V6
238235
/// [`false`]: ../../std/primitive.bool.html
239-
/// [IP address]: ../../std/net/enum.IpAddr.html
240-
/// [IPv6 address]: ../../std/net/enum.IpAddr.html#variant.V6
236+
/// [`true`]: ../../std/primitive.bool.html
241237
///
242238
/// # Examples
243239
///
@@ -255,9 +251,9 @@ impl SocketAddr {
255251
}
256252

257253
impl SocketAddrV4 {
258-
/// Creates a new socket address from an [IPv4 address] and a port number.
254+
/// Creates a new socket address from an [`IPv4` address] and a port number.
259255
///
260-
/// [IPv4 address]: ../../std/net/struct.Ipv4Addr.html
256+
/// [`IPv4` address]: Ipv4Addr
261257
///
262258
/// # Examples
263259
///
@@ -342,14 +338,14 @@ impl SocketAddrV4 {
342338
}
343339

344340
impl SocketAddrV6 {
345-
/// Creates a new socket address from an [IPv6 address], a 16-bit port number,
341+
/// Creates a new socket address from an [`IPv6` address], a 16-bit port number,
346342
/// and the `flowinfo` and `scope_id` fields.
347343
///
348344
/// For more information on the meaning and layout of the `flowinfo` and `scope_id`
349345
/// parameters, see [IETF RFC 2553, Section 3.3].
350346
///
351347
/// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3
352-
/// [IPv6 address]: ../../std/net/struct.Ipv6Addr.html
348+
/// [`IPv6` address]: Ipv6Addr
353349
///
354350
/// # Examples
355351
///
@@ -461,9 +457,7 @@ impl SocketAddrV6 {
461457

462458
/// Changes the flow information associated with this socket address.
463459
///
464-
/// See the [`flowinfo`] method's documentation for more details.
465-
///
466-
/// [`flowinfo`]: #method.flowinfo
460+
/// See [`SocketAddrV6::flowinfo`]'s documentation for more details.
467461
///
468462
/// # Examples
469463
///
@@ -501,9 +495,7 @@ impl SocketAddrV6 {
501495

502496
/// Changes the scope ID associated with this socket address.
503497
///
504-
/// See the [`scope_id`] method's documentation for more details.
505-
///
506-
/// [`scope_id`]: #method.scope_id
498+
/// See [`SocketAddrV6::scope_id`]'s documentation for more details.
507499
///
508500
/// # Examples
509501
///
@@ -535,9 +527,6 @@ impl FromInner<c::sockaddr_in6> for SocketAddrV6 {
535527
#[stable(feature = "ip_from_ip", since = "1.16.0")]
536528
impl From<SocketAddrV4> for SocketAddr {
537529
/// Converts a [`SocketAddrV4`] into a [`SocketAddr::V4`].
538-
///
539-
/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html
540-
/// [`SocketAddr::V4`]: ../../std/net/enum.SocketAddr.html#variant.V4
541530
fn from(sock4: SocketAddrV4) -> SocketAddr {
542531
SocketAddr::V4(sock4)
543532
}
@@ -546,9 +535,6 @@ impl From<SocketAddrV4> for SocketAddr {
546535
#[stable(feature = "ip_from_ip", since = "1.16.0")]
547536
impl From<SocketAddrV6> for SocketAddr {
548537
/// Converts a [`SocketAddrV6`] into a [`SocketAddr::V6`].
549-
///
550-
/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html
551-
/// [`SocketAddr::V6`]: ../../std/net/enum.SocketAddr.html#variant.V6
552538
fn from(sock6: SocketAddrV6) -> SocketAddr {
553539
SocketAddr::V6(sock6)
554540
}
@@ -562,13 +548,6 @@ impl<I: Into<IpAddr>> From<(I, u16)> for SocketAddr {
562548
/// and creates a [`SocketAddr::V6`] for a [`IpAddr::V6`].
563549
///
564550
/// `u16` is treated as port of the newly created [`SocketAddr`].
565-
///
566-
/// [`IpAddr`]: ../../std/net/enum.IpAddr.html
567-
/// [`IpAddr::V4`]: ../../std/net/enum.IpAddr.html#variant.V4
568-
/// [`IpAddr::V6`]: ../../std/net/enum.IpAddr.html#variant.V6
569-
/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html
570-
/// [`SocketAddr::V4`]: ../../std/net/enum.SocketAddr.html#variant.V4
571-
/// [`SocketAddr::V6`]: ../../std/net/enum.SocketAddr.html#variant.V6
572551
fn from(pieces: (I, u16)) -> SocketAddr {
573552
SocketAddr::new(pieces.0.into(), pieces.1)
574553
}
@@ -785,18 +764,11 @@ impl hash::Hash for SocketAddrV6 {
785764
/// Addresses returned by the operating system that are not IP addresses are
786765
/// silently ignored.
787766
///
788-
/// [`FromStr`]: ../../std/str/trait.FromStr.html
789-
/// [`IpAddr`]: ../../std/net/enum.IpAddr.html
790-
/// [`Ipv4Addr`]: ../../std/net/struct.Ipv4Addr.html
791-
/// [`Ipv6Addr`]: ../../std/net/struct.Ipv6Addr.html
792-
/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html
793-
/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html
794-
/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html
795-
/// [`&str`]: ../../std/primitive.str.html
796-
/// [`TcpStream`]: ../../std/net/struct.TcpStream.html
797-
/// [`to_socket_addrs`]: #tymethod.to_socket_addrs
798-
/// [`UdpSocket`]: ../../std/net/struct.UdpSocket.html
799-
/// [`u16`]: ../../std/primitive.u16.html
767+
/// [`FromStr`]: crate::str::FromStr
768+
/// [`&str`]: str
769+
/// [`TcpStream`]: crate::net::TcpStream
770+
/// [`to_socket_addrs`]: ToSocketAddrs::to_socket_addrs
771+
/// [`UdpSocket`]: crate::net::UdpSocket
800772
///
801773
/// # Examples
802774
///
@@ -867,7 +839,7 @@ impl hash::Hash for SocketAddrV6 {
867839
/// let stream = TcpStream::connect((Ipv4Addr::new(127, 0, 0, 1), 443));
868840
/// ```
869841
///
870-
/// [`TcpStream::connect`]: ../../std/net/struct.TcpStream.html#method.connect
842+
/// [`TcpStream::connect`]: crate::net::TcpStream::connect
871843
#[stable(feature = "rust1", since = "1.0.0")]
872844
pub trait ToSocketAddrs {
873845
/// Returned iterator over socket addresses which this type may correspond

0 commit comments

Comments
 (0)