Skip to content

Commit 634dcd0

Browse files
committed
std::net: add warning in Ipv6Addr::is_unicast_site_local() doc
site-local addresses are deprecated, so we should warn users about it.
1 parent 6662777 commit 634dcd0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libstd/net/ip.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,14 @@ impl Ipv6Addr {
13351335
/// assert_eq!(Ipv6Addr::new(0xfec2, 0, 0, 0, 0, 0, 0, 0).is_unicast_site_local(), true);
13361336
/// }
13371337
/// ```
1338+
///
1339+
/// # Warning
1340+
///
1341+
/// As per [RFC 3879], the whole `FEC0::/10` prefix is
1342+
/// deprecated. New software must not support site-local
1343+
/// addresses.
1344+
///
1345+
/// [RFC 3879]: https://tools.ietf.org/html/rfc3879
13381346
pub fn is_unicast_site_local(&self) -> bool {
13391347
(self.segments()[0] & 0xffc0) == 0xfec0
13401348
}

0 commit comments

Comments
 (0)