-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Move IpAddr, SocketAddr and V4+V6 related types to core
#104265
Conversation
r? @thomcc (rustbot has picked a reviewer for you, use r? to override) |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
@rustbot label +T-libs-api -T-libs |
Should moves like this mark the new types in Also, what to do with all the existing stability attributes, such as: #[stable(feature = "ip_shared", since = "1.12.0")]
pub const fn is_loopback(&self) -> bool { Do we leave them as is in moves like this? I have not yet found another PR doing a similar move. |
bffa4ec
to
ea37750
Compare
I think this is blocked on the RFC at the moment. |
☔ The latest upstream changes (presumably #104428) made this pull request unmergeable. Please resolve the merge conflicts. |
Has anyone done testing about code sizes in microcontroller / wasm32-u-u context / between code size sensitive targets ? I think tests should be essential to "bench" / measure these kind of things if core is to be added with this stuff that realistically should be standard library stuff - this would alleviate concerns that binary sizes are kept in check. Use-cases are - measured in x86_64 host: e.g. w/
Another |
I have internet connected Cortex-M micros and can help with benchmarking, but I am confused about what is being measured. Embedded |
Binary sizes - There was some other related effort out there somewhere else and might be worthwhile to check if anything was done re: in general and if this could be incorporated somehow there.
Yes that is true and correct. However it could be helpful to come up with a test that stays around and ensures this is correct in case of core::net e.g. for wasm32-u-u that the symbol was stripped for completeness. Question may / probably is how to test it if this is done and what are the downsides of such test if any ? |
I checked binary sizes of the cortex-m-quickstart built for the
Is this not covered by existing dead code tests, such as |
ea37750
to
125dc44
Compare
Rebased and updated. Since the RFC seems to be close to being merged. Changed the std re-exports into type aliases so they can remain stable while the core versions are unstable (under the new feature Not going to touch anything regarding testing/benchmarking the size of The CI failure is something I can reproduce locally but have not yet figured out how to solve 🤔 |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #107187) made this pull request unmergeable. Please resolve the merge conflicts. |
880a99f
to
2066822
Compare
I fixed the merge conflict and the CI error that existed. The stderr of a compiler error changed slightly, so I just needed to adapt the test's expected output. |
To fix this error it looks like we need to update the book. But that's a separate git module. And it's also temporary, while the types are unstable in core... Will the book changes be merged before this PR is approved? I submitted the required change in rust-lang/book#3519 |
@faern: 🔑 Insufficient privileges: Not in reviewers |
@bors r=joshtriplett |
…riplett Move IpAddr, SocketAddr and V4+V6 related types to `core` Implements RFC rust-lang/rfcs#2832. The RFC has completed FCP with disposition merge, but is not yet merged. Moves IP types to `core` as specified in the RFC. The full list of moved types is: `IpAddr`, `Ipv4Addr`, `Ipv6Addr`, `SocketAddr`, `SocketAddrV4`, `SocketAddrV6`, `Ipv6MulticastScope` and `AddrParseError`. Doing this move was one of the main driving arguments behind rust-lang#78802.
…riplett Move IpAddr, SocketAddr and V4+V6 related types to `core` Implements RFC rust-lang/rfcs#2832. The RFC has completed FCP with disposition merge, but is not yet merged. Moves IP types to `core` as specified in the RFC. The full list of moved types is: `IpAddr`, `Ipv4Addr`, `Ipv6Addr`, `SocketAddr`, `SocketAddrV4`, `SocketAddrV6`, `Ipv6MulticastScope` and `AddrParseError`. Doing this move was one of the main driving arguments behind rust-lang#78802.
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#104265 (Move IpAddr, SocketAddr and V4+V6 related types to `core`) - rust-lang#107110 ([stdio][windows] Use MBTWC and WCTMB) - rust-lang#108308 (Allow building serde and serde_derive in parallel) - rust-lang#108363 (Move the unused extern crate check back to the resolver.) - rust-lang#108519 (Bages for easy access links to Rust community) - rust-lang#108522 (Commit some new solver tests) - rust-lang#108523 (Avoid `&str` to `String` conversions) - rust-lang#108533 (diagnostics: avoid querying `associated_item` in the resolver) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
@@ -77,6 +78,9 @@ | |||
#![feature(iter_repeat_n)] | |||
#![feature(iterator_try_collect)] | |||
#![feature(iterator_try_reduce)] | |||
#![feature(const_ip)] | |||
#![feature(const_ipv4)] | |||
#![feature(const_ipv6)] |
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.
I am very surprised that this does not need the ip_in_core
feature? miri-test-libstd is failing due to that feature missing somewhere.
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.
I guess because core
itself does not use anything from core::net
(which is the unstable module). Submodules of core::net
uses parts of itself, but I guess if you are inside an unstable module you can freely use the stuff in it?
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.
This is a different crate though, it is the coretest crate, not the core crate.
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.
Ah, sorry. I misread the path! Yeah, that's very strange. But I see you have a PR up for fixing it 👍
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.
Yeah it fixes miri-test-libstd. But still I am worried that the fact that it builds here without the feature flag might be indicative of a more fundamental problem -- as mentioned elsewhere, historically reexport stability did not work properly.
pub struct Ipv4Addr { | ||
octets: [u8; 4], | ||
} | ||
pub use core::net::{Ipv4Addr, Ipv6Addr}; |
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.
FWIW, I was under the impression that pub use
with different stability doesn't actually work -- that's why intrinsics::transmute
has to be stable, so that it can be pub use
d in mem
. IOW, all reexports of the same type/function must have the same stability. Has that been fixed?
See #18517, which is closed as a duplicate of an issue that is still open.
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.
Quick testing indicates that the feature gate works as expected (except for the strange behavior in coretest).
Cc @petrochenkov your statement here sounds like reexport stability doesn't work properly, has that changed since last year?
add missing feature in core/tests rust-lang#104265 introduced the `ip_in_core` feature. For some reason core tests seem to still build without that feature -- no idea how that is possible. Might be related to rust-lang#15702? I was under the impression that `pub use` with different stability doesn't actually work. That's why `intrinsics::transmute` is stable, for example. Either way, core tests fail to build in miri-test-libstd, and adding the feature fixes that. r? `@thomcc`
This reduced |
add missing feature in core/tests rust-lang#104265 introduced the `ip_in_core` feature. For some reason core tests seem to still build without that feature -- no idea how that is possible. Might be related to rust-lang#15702? I was under the impression that `pub use` with different stability doesn't actually work. That's why `intrinsics::transmute` is stable, for example. Either way, core tests fail to build in miri-test-libstd, and adding the feature fixes that. r? ``@thomcc``
add missing feature in core/tests rust-lang#104265 introduced the `ip_in_core` feature. For some reason core tests seem to still build without that feature -- no idea how that is possible. Might be related to rust-lang#15702? I was under the impression that `pub use` with different stability doesn't actually work. That's why `intrinsics::transmute` is stable, for example. Either way, core tests fail to build in miri-test-libstd, and adding the feature fixes that. r? ```@thomcc```
add missing feature in core/tests rust-lang/rust#104265 introduced the `ip_in_core` feature. For some reason core tests seem to still build without that feature -- no idea how that is possible. Might be related to rust-lang/rust#15702? I was under the impression that `pub use` with different stability doesn't actually work. That's why `intrinsics::transmute` is stable, for example. Either way, core tests fail to build in miri-test-libstd, and adding the feature fixes that. r? ```@thomcc```
Implements RFC rust-lang/rfcs#2832. The RFC has completed FCP with disposition merge, but is not yet merged.
Moves IP types to
core
as specified in the RFC.The full list of moved types is:
IpAddr
,Ipv4Addr
,Ipv6Addr
,SocketAddr
,SocketAddrV4
,SocketAddrV6
,Ipv6MulticastScope
andAddrParseError
.Doing this move was one of the main driving arguments behind #78802.