Merged
Conversation
Collaborator
|
rustbot has assigned @Mark-Simulacrum. Use |
This comment has been minimized.
This comment has been minimized.
camsteffen
reviewed
Sep 23, 2025
camsteffen
reviewed
Sep 23, 2025
Mark-Simulacrum
requested changes
Sep 28, 2025
| } | ||
| } | ||
| // As `buf.capacity()` is always positive (as Rust allocations cannot | ||
| // be larger than `isize::MAX` bytes), the only way `EINVAL` can be |
Member
There was a problem hiding this comment.
buf.capacity() is a usize, so saying it's "always positive" feels confusing to me. I'm not sure what relevance isize has here.
Member
Author
There was a problem hiding this comment.
gethostname documents that EINVAL is returned if size is negative (even though it is an unsigned integer). I've changed the comment to mention only isize::MAX.
Member
Author
|
I've rephrased the comment and also changed the Windows version to use |
Member
|
@bors r+ |
Collaborator
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Sep 29, 2025
std: implement `hostname` Resolves rust-lang/libs-team#330 Tracking issue: rust-lang#135142 This is based on rust-lang#135141, but I've reimplemented the UNIX version, which now: * uses `sysconf(_SC_HOST_NAME_MAX)` as an initial buffer length * returns `OutOfMemory` if the `Vec` allocation fails * retries the operation if it detects that the name returned by `gethostname` was truncated Additionally, as part of the rebase, I had to move some WinSock abstractions (initialisation and error access) to `sys::pal` so that they can be accessed from `sys::net::hostname`. CC `@orowith2os` (and thank you for your work!)
bors
added a commit
that referenced
this pull request
Sep 29, 2025
Rollup of 6 pull requests Successful merges: - #143613 (Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default) - #146937 (std: implement `hostname`) - #147040 (mbe: macro_check: Fix function comments referencing non-existent parameters) - #147131 (Use MirPatch in simplify_branches.) - #147133 (Remove one loop in `extract_cfg_from_attrs`) - #147150 (Emit allocator attributes for allocator shim) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Sep 29, 2025
Rollup of 5 pull requests Successful merges: - #146937 (std: implement `hostname`) - #147040 (mbe: macro_check: Fix function comments referencing non-existent parameters) - #147131 (Use MirPatch in simplify_branches.) - #147133 (Remove one loop in `extract_cfg_from_attrs`) - #147150 (Emit allocator attributes for allocator shim) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Sep 30, 2025
Rollup merge of #146937 - joboet:gethostname, r=Mark-Simulacrum std: implement `hostname` Resolves rust-lang/libs-team#330 Tracking issue: #135142 This is based on #135141, but I've reimplemented the UNIX version, which now: * uses `sysconf(_SC_HOST_NAME_MAX)` as an initial buffer length * returns `OutOfMemory` if the `Vec` allocation fails * retries the operation if it detects that the name returned by `gethostname` was truncated Additionally, as part of the rebase, I had to move some WinSock abstractions (initialisation and error access) to `sys::pal` so that they can be accessed from `sys::net::hostname`. CC ``@orowith2os`` (and thank you for your work!)
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Oct 1, 2025
…boet Fix broken STD build for ESP-IDF PRs rust-lang#147162 and rust-lang#146937 did [broke](https://github.com/esp-rs/esp-idf-sys/actions/runs/18151791720/job/51663969786) the STD build for `target_os = "espidf"` because that target [does not have neither a `gethostname`, not a `libc::_SC_HOST_NAME_MAX` by default](espressif/esp-idf#14849). While there is a [3rd party component for this syscall](https://components.espressif.com/components/espressif/sock_utils/versions/0.2.2/readme) in the ESP-IDF component registry, I don't think we should use it, because it does not come with ESP-IDF by default. Therefore, the one-liner fix just re-routes ESP-IDF into the `unsupported` branch.
rust-timer
added a commit
that referenced
this pull request
Oct 1, 2025
Rollup merge of #147213 - ivmarkov:fix-hostname-espidf, r=joboet Fix broken STD build for ESP-IDF PRs #147162 and #146937 did [broke](https://github.com/esp-rs/esp-idf-sys/actions/runs/18151791720/job/51663969786) the STD build for `target_os = "espidf"` because that target [does not have neither a `gethostname`, not a `libc::_SC_HOST_NAME_MAX` by default](espressif/esp-idf#14849). While there is a [3rd party component for this syscall](https://components.espressif.com/components/espressif/sock_utils/versions/0.2.2/readme) in the ESP-IDF component registry, I don't think we should use it, because it does not come with ESP-IDF by default. Therefore, the one-liner fix just re-routes ESP-IDF into the `unsupported` branch.
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Oct 9, 2025
std: implement `hostname` Resolves rust-lang/libs-team#330 Tracking issue: rust-lang#135142 This is based on rust-lang#135141, but I've reimplemented the UNIX version, which now: * uses `sysconf(_SC_HOST_NAME_MAX)` as an initial buffer length * returns `OutOfMemory` if the `Vec` allocation fails * retries the operation if it detects that the name returned by `gethostname` was truncated Additionally, as part of the rebase, I had to move some WinSock abstractions (initialisation and error access) to `sys::pal` so that they can be accessed from `sys::net::hostname`. CC ``@orowith2os`` (and thank you for your work!)
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Oct 9, 2025
…boet Fix broken STD build for ESP-IDF PRs rust-lang#147162 and rust-lang#146937 did [broke](https://github.com/esp-rs/esp-idf-sys/actions/runs/18151791720/job/51663969786) the STD build for `target_os = "espidf"` because that target [does not have neither a `gethostname`, not a `libc::_SC_HOST_NAME_MAX` by default](espressif/esp-idf#14849). While there is a [3rd party component for this syscall](https://components.espressif.com/components/espressif/sock_utils/versions/0.2.2/readme) in the ESP-IDF component registry, I don't think we should use it, because it does not come with ESP-IDF by default. Therefore, the one-liner fix just re-routes ESP-IDF into the `unsupported` branch.
3 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves rust-lang/libs-team#330
Tracking issue: #135142
This is based on #135141, but I've reimplemented the UNIX version, which now:
sysconf(_SC_HOST_NAME_MAX)as an initial buffer lengthOutOfMemoryif theVecallocation failsgethostnamewas truncatedAdditionally, as part of the rebase, I had to move some WinSock abstractions (initialisation and error access) to
sys::palso that they can be accessed fromsys::net::hostname.CC @orowith2os (and thank you for your work!)