-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Stabilize the "IP" feature #76098
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
Closed
Closed
Stabilize the "IP" feature #76098
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
1a127d5
stabilize the "ip" feature and document stability guarantees
little-dude 0910bbc
std::net: add Ipv6Multicastscope variants
little-dude 67742d4
Update feature gates
caass d3fea20
Apply suggestions from code review
caass 22520cf
`is_unicast_link_local_strict` --> `is_unicast_link_local`
caass 2c005cb
Add checking for ipv4-(mapped | compatible) addresses
caass 707770c
Add stability attributes to Ipv6MulticastScope
caass 133c62d
remove `/// #![feature(ip)]` tags from doc tests
caass 23f40a3
Remove some more #![feature(ip)] stuff
caass 46bdfcb
Remove some code having to do with link-local strict
caass ec63c55
Change checks for is_unicast_link_local_strict to is_unicast_link_local
caass 6e6f745
Rewrite ipv4 checks to check ipv6 stuff first
caass 341dc82
Fix test cases that checked for relaxed behavior
caass c90cc3d
Restore the relaxed behavior of `is_unicast_link_local`
caass 8364ac0
Revert "Fix test cases that checked for relaxed behavior"
caass 3cf1541
Remove IP feature gate
caass 96d1165
Remove duplicate UI tests as per @CDirkx's suggestions
caass 3825105
Rewrite using new rustdoc comments!!!!
caass 18773f9
Adjust Ipv4-in-Ipv6 checking to ignore Ipv4-compatible addresses
caass a0d0771
Revert "Adjust Ipv4-in-Ipv6 checking to ignore Ipv4-compatible addres…
caass 2c836b5
Update doc comments
caass e3487cf
stop treating `::ffff:0.0.0.0` as unspecified
caass a1d4e70
wow i hope i didn't mess something up
caass File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove some more #![feature(ip)] stuff
Getting kind of extremely out of my comfort zone here and modifying quite a few different files...i hope this is all ok...
- Loading branch information
commit 23f40a3a799a42ccf41e8b8a2415974a1c08e679
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// run-pass | ||
|
||
#![feature(const_ipv4)] | ||
|
||
use std::net::{Ipv4Addr, Ipv6Addr}; | ||
|
||
fn main() { | ||
const IP_ADDRESS: Ipv4Addr = Ipv4Addr::new(127, 0, 0, 1); | ||
assert_eq!(IP_ADDRESS, Ipv4Addr::LOCALHOST); | ||
|
||
const OCTETS: [u8; 4] = IP_ADDRESS.octets(); | ||
assert_eq!(OCTETS, [127, 0, 0, 1]); | ||
|
||
const IS_UNSPECIFIED : bool = IP_ADDRESS.is_unspecified(); | ||
assert!(!IS_UNSPECIFIED); | ||
|
||
const IS_LOOPBACK : bool = IP_ADDRESS.is_loopback(); | ||
assert!(IS_LOOPBACK); | ||
|
||
const IS_PRIVATE : bool = IP_ADDRESS.is_private(); | ||
assert!(!IS_PRIVATE); | ||
|
||
const IS_LINK_LOCAL : bool = IP_ADDRESS.is_link_local(); | ||
assert!(!IS_LINK_LOCAL); | ||
|
||
const IS_GLOBAL : bool = IP_ADDRESS.is_global(); | ||
assert!(!IS_GLOBAL); | ||
|
||
const IS_SHARED : bool = IP_ADDRESS.is_shared(); | ||
assert!(!IS_SHARED); | ||
|
||
const IS_IETF_PROTOCOL_ASSIGNMENT : bool = IP_ADDRESS.is_ietf_protocol_assignment(); | ||
assert!(!IS_IETF_PROTOCOL_ASSIGNMENT); | ||
|
||
const IS_BENCHMARKING : bool = IP_ADDRESS.is_benchmarking(); | ||
assert!(!IS_BENCHMARKING); | ||
|
||
const IS_RESERVED : bool = IP_ADDRESS.is_reserved(); | ||
assert!(!IS_RESERVED); | ||
|
||
const IS_MULTICAST : bool = IP_ADDRESS.is_multicast(); | ||
assert!(!IS_MULTICAST); | ||
|
||
const IS_BROADCAST : bool = IP_ADDRESS.is_broadcast(); | ||
assert!(!IS_BROADCAST); | ||
|
||
const IS_DOCUMENTATION : bool = IP_ADDRESS.is_documentation(); | ||
assert!(!IS_DOCUMENTATION); | ||
|
||
const IP_V6_COMPATIBLE : Ipv6Addr = IP_ADDRESS.to_ipv6_compatible(); | ||
assert_eq!(IP_V6_COMPATIBLE, | ||
Ipv6Addr::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 0, 0, 1])); | ||
|
||
const IP_V6_MAPPED : Ipv6Addr = IP_ADDRESS.to_ipv6_mapped(); | ||
assert_eq!(IP_V6_MAPPED, | ||
Ipv6Addr::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 127, 0, 0, 1])); | ||
} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// run-pass | ||
|
||
#![feature(const_ipv6)] | ||
|
||
use std::net::{Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}; | ||
|
||
fn main() { | ||
const IP_ADDRESS : Ipv6Addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1); | ||
assert_eq!(IP_ADDRESS, Ipv6Addr::LOCALHOST); | ||
|
||
const SEGMENTS : [u16; 8] = IP_ADDRESS.segments(); | ||
assert_eq!(SEGMENTS, [0 ,0 ,0 ,0 ,0 ,0 ,0, 1]); | ||
|
||
const OCTETS : [u8; 16] = IP_ADDRESS.octets(); | ||
assert_eq!(OCTETS, [0 ,0 ,0 ,0 ,0 ,0 ,0, 0 ,0 ,0 ,0 ,0 ,0 ,0, 0, 1]); | ||
|
||
const IS_UNSPECIFIED : bool = IP_ADDRESS.is_unspecified(); | ||
assert!(!IS_UNSPECIFIED); | ||
|
||
const IS_LOOPBACK : bool = IP_ADDRESS.is_loopback(); | ||
assert!(IS_LOOPBACK); | ||
|
||
const IS_GLOBAL : bool = IP_ADDRESS.is_global(); | ||
assert!(!IS_GLOBAL); | ||
|
||
const IS_UNIQUE_LOCAL : bool = IP_ADDRESS.is_unique_local(); | ||
assert!(!IS_UNIQUE_LOCAL); | ||
|
||
const IS_UNICAST_LINK_LOCAL_STRICT : bool = IP_ADDRESS.is_unicast_link_local_strict(); | ||
assert!(!IS_UNICAST_LINK_LOCAL_STRICT); | ||
|
||
const IS_UNICAST_LINK_LOCAL : bool = IP_ADDRESS.is_unicast_link_local(); | ||
assert!(!IS_UNICAST_LINK_LOCAL); | ||
|
||
const IS_UNICAST_SITE_LOCAL : bool = IP_ADDRESS.is_unicast_site_local(); | ||
assert!(!IS_UNICAST_SITE_LOCAL); | ||
|
||
const IS_DOCUMENTATION : bool = IP_ADDRESS.is_documentation(); | ||
assert!(!IS_DOCUMENTATION); | ||
|
||
const IS_UNICAST_GLOBAL : bool = IP_ADDRESS.is_unicast_global(); | ||
assert!(!IS_UNICAST_GLOBAL); | ||
|
||
const MULTICAST_SCOPE : Option<Ipv6MulticastScope> = IP_ADDRESS.multicast_scope(); | ||
assert_eq!(MULTICAST_SCOPE, None); | ||
|
||
const IS_MULTICAST : bool = IP_ADDRESS.is_multicast(); | ||
assert!(!IS_MULTICAST); | ||
|
||
const IP_V4 : Option<Ipv4Addr> = IP_ADDRESS.to_ipv4(); | ||
assert_eq!(IP_V4.unwrap(), Ipv4Addr::new(0, 0, 0, 1)); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.