Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for IP constructors #44582
Comments
alexcrichton
added
B-unstable
T-libs
labels
Sep 15, 2017
TimNN
added
the
C-tracking-issue
label
Sep 17, 2017
This comment has been minimized.
This comment has been minimized.
ghost
commented
Oct 7, 2017
|
Is there any way to implement these as I personally don't like this kind of trivial function. |
This comment has been minimized.
This comment has been minimized.
|
See also #39819 |
This comment has been minimized.
This comment has been minimized.
|
I’d also like these to be associated
If we’re doing down this road, it seems like many more APIs should also be @rust-lang/libs what do you think? |
This comment has been minimized.
This comment has been minimized.
|
I think I'd prefer these to be associated consts as well. We don't necessarily need to make all of those functions const as well - we can just directly initialize the structures. |
This comment has been minimized.
This comment has been minimized.
|
Hmm yes, I suppose we could replace the |
This comment has been minimized.
This comment has been minimized.
Kixunil
commented
Mar 18, 2018
|
Maybe I'm missing something, but aren't IP addresses independent of endianness? In other words, aren't they |
This comment has been minimized.
This comment has been minimized.
|
An |
This comment has been minimized.
This comment has been minimized.
|
Right. |
This comment has been minimized.
This comment has been minimized.
Kixunil
commented
Mar 18, 2018
|
OK, thanks for explaining! An alternative would be to just |
This comment has been minimized.
This comment has been minimized.
|
I think I’d prefer this over transmute: Ipv4Addr {
inner: c::in_addr {
// 127.0.0.1
#[cfg(target_endian = "big")]
s_addr: 0x7F_00_00_01_u32,
#[cfg(target_endian = "little")]
s_addr: 0x01_00_00_7F_u32,
}
}(Either way, with an |
This comment has been minimized.
This comment has been minimized.
|
The libs team discussed this and the consensus was to stabilize this as associated constants (in uppercase: @rfcbot fcp merge |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Mar 28, 2018
•
|
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
rfcbot
added
proposed-final-comment-period
final-comment-period
and removed
proposed-final-comment-period
labels
Mar 28, 2018
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Mar 28, 2018
|
|
This comment has been minimized.
This comment has been minimized.
|
I started working on changing this to associated constants, but ran into a bit of a roadblock. |
This comment has been minimized.
This comment has been minimized.
|
hmm, actually it looks like the non-public field is just used for alignment. Maybe now that |
This comment has been minimized.
This comment has been minimized.
|
@tmccombs Maybe add |
tmccombs
added a commit
to tmccombs/libc
that referenced
this issue
Apr 5, 2018
tmccombs
referenced this issue
Apr 5, 2018
Closed
Use #[repr(align(32))] instead of private field for in6_addr. #963
tmccombs
added a commit
to tmccombs/libc
that referenced
this issue
Apr 5, 2018
This comment has been minimized.
This comment has been minimized.
For unix at least, in6_addr comes from the libc crate. Which it looks like has to support older versions of rust. So even when Similarly I don't think I can add |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Apr 7, 2018
|
The final comment period is now complete. |
Centril
added
disposition-merge
finished-final-comment-period
and removed
final-comment-period
labels
May 24, 2018
This comment has been minimized.
This comment has been minimized.
|
I just got PR #51171 merged making the compiler intrinsics for endianess conversion ( For |
This comment has been minimized.
This comment has been minimized.
And I don't think it can be, unless it is a compiler intrinsic. And the Ipv4Addr is currently doable (although having a const |
faern
referenced this issue
Jul 30, 2018
Merged
Make IpvXAddr::new const fns and the well known addresses associated constants #52872
This comment has been minimized.
This comment has been minimized.
|
I implemented this (and a bit more) in #52872 |
bors
added a commit
that referenced
this issue
Aug 3, 2018
cramertj
added a commit
to cramertj/rust
that referenced
this issue
Aug 3, 2018
bors
added a commit
that referenced
this issue
Aug 4, 2018
bors
added a commit
that referenced
this issue
Aug 5, 2018
bors
added a commit
that referenced
this issue
Aug 8, 2018
bors
added a commit
that referenced
this issue
Aug 8, 2018
bors
closed this
in
#52872
Aug 8, 2018
This comment has been minimized.
This comment has been minimized.
|
This should probably not have been closed Anyway. Now that this is merged, all that should be left is to mark the constants as stable I guess. |
This comment has been minimized.
This comment has been minimized.
|
Reopening to track stabilization. |
SimonSapin
reopened this
Aug 8, 2018
This comment has been minimized.
This comment has been minimized.
|
I should point out that I also added
|
tmccombs
added a commit
to tmccombs/rust
that referenced
this issue
Aug 9, 2018
This comment has been minimized.
This comment has been minimized.
|
I created a PR to stabilize (including BROADCAST) but can change it if that isn't desired. |
jcdyer commentedSep 15, 2017
•
edited by SimonSapin
Tracking issue for IP address convenience constructors, added in #44395, modified in #52872.