-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
std: replace the FromInner
implementation for addresses with private conversion functions
#136699
Merged
Conversation
This file contains 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
cuviper
approved these changes
Feb 10, 2025
LGTM! @bors r+ |
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Feb 11, 2025
std: replace the `FromInner` implementation for addresses with private conversion functions Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed. I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 11, 2025
Rollup of 6 pull requests Successful merges: - rust-lang#134999 (Add cygwin target.) - rust-lang#135677 (Small `rustc_resolve` cleanups) - rust-lang#136699 (std: replace the `FromInner` implementation for addresses with private conversion functions) - rust-lang#136758 (tests: `-Copt-level=3` instead of `-O` in assembly tests) - rust-lang#136761 (tests: `-Copt-level=3` instead of `-O` in codegen tests) - rust-lang#136833 (compiler: die immediately instead of handling unknown target codegen) Failed merges: - rust-lang#136808 (Try to recover from path sep error in type parsing) r? `@ghost` `@rustbot` modify labels: rollup
fmease
added a commit
to fmease/rust
that referenced
this pull request
Feb 11, 2025
std: replace the `FromInner` implementation for addresses with private conversion functions Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed. I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 11, 2025
Rollup of 7 pull requests Successful merges: - rust-lang#134090 (Stabilize target_feature_11) - rust-lang#134999 (Add cygwin target.) - rust-lang#135025 (Cast allocas to default address space) - rust-lang#135408 (x86: make SSE2 required for i686 hardfloat targets and use it to pass SIMD types) - rust-lang#135549 (Document some safety constraints and use more safe wrappers) - rust-lang#136193 (Implement pattern type ffi checks) - rust-lang#136699 (std: replace the `FromInner` implementation for addresses with private conversion functions) Failed merges: - rust-lang#136758 (tests: `-Copt-level=3` instead of `-O` in assembly tests) r? `@ghost` `@rustbot` modify labels: rollup
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Feb 11, 2025
std: replace the `FromInner` implementation for addresses with private conversion functions Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed. I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 12, 2025
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#135549 (Document some safety constraints and use more safe wrappers) - rust-lang#135965 (In "specify type" suggestion, skip type params that are already known) - rust-lang#136193 (Implement pattern type ffi checks) - rust-lang#136646 (Add a TyPat in the AST to reuse the generic arg lowering logic) - rust-lang#136699 (std: replace the `FromInner` implementation for addresses with private conversion functions) - rust-lang#136874 (Change the issue number for `likely_unlikely` and `cold_path`) - rust-lang#136884 (Lower fn items as ZST valtrees and delay a bug) - rust-lang#136885 (i686-linux-android: increase CPU baseline to Pentium 4 (without an actual change) r? `@ghost` `@rustbot` modify labels: rollup
@bors r- I think this failed here? UEFI #136887 (comment) |
…e conversion functions Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed. I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
68ff0f1
to
80c60fe
Compare
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Feb 12, 2025
std: replace the `FromInner` implementation for addresses with private conversion functions Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed. I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 12, 2025
…llaumeGomez Rollup of 9 pull requests Successful merges: - rust-lang#135025 (Cast allocas to default address space) - rust-lang#136217 (Mark condition/carry bit as clobbered in C-SKY inline assembly) - rust-lang#136699 (std: replace the `FromInner` implementation for addresses with private conversion functions) - rust-lang#136758 (tests: `-Copt-level=3` instead of `-O` in assembly tests) - rust-lang#136761 (tests: `-Copt-level=3` instead of `-O` in codegen tests) - rust-lang#136807 (compiler: internally merge `PtxKernel` into `GpuKernel`) - rust-lang#136818 (Implement `read*_exact` for `std:io::repeat`) - rust-lang#136831 (Update stdarch) - rust-lang#136916 (use cc archiver as default in `cc2ar`) r? `@ghost` `@rustbot` modify labels: rollup
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Feb 13, 2025
std: replace the `FromInner` implementation for addresses with private conversion functions Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed. I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
This was referenced Feb 13, 2025
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 13, 2025
Rollup of 12 pull requests Successful merges: - rust-lang#134090 (Stabilize target_feature_11) - rust-lang#135025 (Cast allocas to default address space) - rust-lang#135841 (Reject `?Trait` bounds in various places where we unconditionally warned since 1.0) - rust-lang#136217 (Mark condition/carry bit as clobbered in C-SKY inline assembly) - rust-lang#136699 (std: replace the `FromInner` implementation for addresses with private conversion functions) - rust-lang#136806 (Fix cycle when debug-printing opaque types from RPITIT) - rust-lang#136807 (compiler: internally merge `PtxKernel` into `GpuKernel`) - rust-lang#136818 (Implement `read*_exact` for `std:io::repeat`) - rust-lang#136927 (Correctly escape hashtags when running `invalid_rust_codeblocks` lint) - rust-lang#136937 (Update books) - rust-lang#136945 (Add diagnostic item for `std::io::BufRead`) - rust-lang#136947 (Reinstate nnethercote in the review rotation.) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 13, 2025
Rollup merge of rust-lang#136699 - joboet:netaddr_from_inner, r=cuviper std: replace the `FromInner` implementation for addresses with private conversion functions Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed. I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
bjorn3
pushed a commit
to bjorn3/rust
that referenced
this pull request
Feb 15, 2025
Rollup of 12 pull requests Successful merges: - rust-lang#134090 (Stabilize target_feature_11) - rust-lang#135025 (Cast allocas to default address space) - rust-lang#135841 (Reject `?Trait` bounds in various places where we unconditionally warned since 1.0) - rust-lang#136217 (Mark condition/carry bit as clobbered in C-SKY inline assembly) - rust-lang#136699 (std: replace the `FromInner` implementation for addresses with private conversion functions) - rust-lang#136806 (Fix cycle when debug-printing opaque types from RPITIT) - rust-lang#136807 (compiler: internally merge `PtxKernel` into `GpuKernel`) - rust-lang#136818 (Implement `read*_exact` for `std:io::repeat`) - rust-lang#136927 (Correctly escape hashtags when running `invalid_rust_codeblocks` lint) - rust-lang#136937 (Update books) - rust-lang#136945 (Add diagnostic item for `std::io::BufRead`) - rust-lang#136947 (Reinstate nnethercote in the review rotation.) r? `@ghost` `@rustbot` modify labels: rollup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
O-solid
Operating System: SOLID
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
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.
Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed.
I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a
sockaddr_storage
resulted in unsound usage insideLookupHost::next
, which could create a reference to a structure smaller thansockaddr_storage
. Thus I've replaced the argument type with a pointer and made the functionunsafe
.