Skip to content

Commit

Permalink
std::net: add warning in Ipv6Addr::is_unicast_site_local() doc
Browse files Browse the repository at this point in the history
site-local addresses are deprecated, so we should warn users about it.
  • Loading branch information
little-dude committed Apr 23, 2019
1 parent 6662777 commit 634dcd0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libstd/net/ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,14 @@ impl Ipv6Addr {
/// assert_eq!(Ipv6Addr::new(0xfec2, 0, 0, 0, 0, 0, 0, 0).is_unicast_site_local(), true);
/// }
/// ```
///
/// # Warning
///
/// As per [RFC 3879], the whole `FEC0::/10` prefix is
/// deprecated. New software must not support site-local
/// addresses.
///
/// [RFC 3879]: https://tools.ietf.org/html/rfc3879
pub fn is_unicast_site_local(&self) -> bool {
(self.segments()[0] & 0xffc0) == 0xfec0
}
Expand Down

0 comments on commit 634dcd0

Please sign in to comment.