Skip to content

Commit 74b886a

Browse files
committed
Auto merge of #32211 - achanda:ipv6-global, r=alexcrichton
Reject unspecified IP from global Also fixed the test
2 parents d5880ff + 534bd19 commit 74b886a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libstd/net/ip.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,12 @@ impl Ipv6Addr {
371371
/// - the link-local addresses
372372
/// - the (deprecated) site-local addresses
373373
/// - unique local addresses
374+
/// - the unspecified address
374375
pub fn is_unicast_global(&self) -> bool {
375376
!self.is_multicast()
376377
&& !self.is_loopback() && !self.is_unicast_link_local()
377378
&& !self.is_unicast_site_local() && !self.is_unique_local()
379+
&& !self.is_unspecified()
378380
}
379381

380382
/// Returns the address's multicast scope if the address is multicast.
@@ -768,7 +770,7 @@ mod tests {
768770

769771
// unspec loopbk uniqlo global unill unisl uniglo mscope
770772
check("::",
771-
true, false, false, true, false, false, true, None);
773+
true, false, false, false, false, false, false, None);
772774
check("::1",
773775
false, true, false, false, false, false, false, None);
774776
check("::0.0.0.2",

0 commit comments

Comments
 (0)