-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Ipv6Addr::is_benchmarking
#86434
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
let unspecified: u16 = 1 << 0; | ||
let loopback: u16 = 1 << 1; | ||
let unique_local: u16 = 1 << 2; | ||
let global: u16 = 1 << 3; | ||
let unicast_link_local: u16 = 1 << 4; | ||
let unicast_global: u16 = 1 << 7; | ||
let documentation: u16 = 1 << 8; | ||
let multicast_interface_local: u16 = 1 << 9; | ||
let multicast_link_local: u16 = 1 << 10; | ||
let multicast_realm_local: u16 = 1 << 11; | ||
let multicast_admin_local: u16 = 1 << 12; | ||
let multicast_site_local: u16 = 1 << 13; | ||
let multicast_organization_local: u16 = 1 << 14; | ||
let multicast_global: u16 = 1 << 15; | ||
let multicast: u16 = multicast_interface_local | ||
let unspecified: u32 = 1 << 0; | ||
let loopback: u32 = 1 << 1; | ||
let unique_local: u32 = 1 << 2; | ||
let global: u32 = 1 << 3; | ||
let unicast_link_local: u32 = 1 << 4; | ||
let unicast_global: u32 = 1 << 7; | ||
let documentation: u32 = 1 << 8; | ||
let benchmarking: u32 = 1 << 16; | ||
let multicast_interface_local: u32 = 1 << 9; | ||
let multicast_link_local: u32 = 1 << 10; | ||
let multicast_realm_local: u32 = 1 << 11; | ||
let multicast_admin_local: u32 = 1 << 12; | ||
let multicast_site_local: u32 = 1 << 13; | ||
let multicast_organization_local: u32 = 1 << 14; | ||
let multicast_global: u32 = 1 << 15; | ||
let multicast: u32 = multicast_interface_local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More than 16 properties are now being checked, so the tag type is changed from u16
to u32
. Also benchmarking
is assigned value i << 16
, the order doesn't really matter, only that the value is distinct from the other tags.
@@ -313,6 +321,7 @@ fn ip_properties() { | |||
check!("ff08::", multicast); | |||
check!("ff0e::", global | multicast); | |||
check!("2001:db8:85a3::8a2e:370:7334", doc); | |||
check!("2001:2::ac32:23ff:21", global | benchmarking); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the IANA IPv6 Special Address Registry benchmarking addresses are not globally reachable. However due to the current simplistic implementation of Ipv6Addr::is_global
compared to Ipv4Addr::is_global
, Rust currently considers benchmarking addresses global. I plan to address this in a future PR reworking is_global
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rework of Ipv6Addr::is_global
has been submitted (#86634).
check!( | ||
"2001:2::ac32:23ff:21", | ||
&[0x20, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0xac, 0x32, 0x23, 0xff, 0, 0x21], | ||
global | unicast_global | benchmarking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, benchmarking addresses should not actually be globally reachable. They do however have global unicast scope.
This comment has been minimized.
This comment has been minimized.
r? @joshtriplett for T-libs-api review |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@bors r+ |
📌 Commit cbaccc1 has been approved by |
…plett Add `Ipv6Addr::is_benchmarking` This PR adds the unstable method `Ipv6Addr::is_benchmarking`. This method is added for parity with `Ipv4Addr::is_benchmarking`, and I intend to use it in a future rework of `Ipv6Addr::is_global` (edit: rust-lang#86634) to more accurately follow the [IANA Special Address Registry](https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml) (like is done in `Ipv4Addr::is_global`). With `Ipv6Addr::is_benchmarking` and `Ipv4Addr::is_benchmarking` now both existing, `IpAddr::is_benchmarking` is also added.
…arth Rollup of 14 pull requests Successful merges: - rust-lang#86434 (Add `Ipv6Addr::is_benchmarking`) - rust-lang#86828 (const fn for option copied, take & replace) - rust-lang#87679 (BTree: refine some comments) - rust-lang#87910 (Mark unsafe methods NonZero*::unchecked_(add|mul) as const.) - rust-lang#88286 (Remove unnecessary unsafe block in `process_unix`) - rust-lang#88305 (Manual Debug for Unix ExitCode ExitStatus ExitStatusError) - rust-lang#88353 (Partially stabilize `array_methods`) - rust-lang#88370 (Add missing `# Panics` section to `Vec` method) - rust-lang#88481 (Remove some feature gates) - rust-lang#89138 (Fix link in Ipv6Addr::to_ipv4 docs) - rust-lang#89401 (Add truncate note to Vec::resize) - rust-lang#89467 (Fix typos in rustdoc/lints) - rust-lang#89472 (Only register `WSACleanup` if `WSAStartup` is actually ever called) - rust-lang#89505 (Add regression test for spurious const error with NLL) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR adds the unstable method
Ipv6Addr::is_benchmarking
. This method is added for parity withIpv4Addr::is_benchmarking
, and I intend to use it in a future rework ofIpv6Addr::is_global
(edit: #86634) to more accurately follow the IANA Special Address Registry (like is done inIpv4Addr::is_global
).With
Ipv6Addr::is_benchmarking
andIpv4Addr::is_benchmarking
now both existing,IpAddr::is_benchmarking
is also added.