Skip to content

Provide optional Read/Write methods for stdio #136769

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Mar 23, 2025

Conversation

thaliaarchi
Copy link
Contributor

@thaliaarchi thaliaarchi commented Feb 9, 2025

Override more of the default methods for io::Read and io::Write for stdio types, when efficient to do so, and deduplicate unsupported types.

Tracked in #136756.

try-job: x86_64-msvc-1

@rustbot
Copy link
Collaborator

rustbot commented Feb 9, 2025

r? @Noratrieb

rustbot has assigned @Noratrieb.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added O-hermit Operating System: Hermit O-SGX Target: SGX O-solid Operating System: SOLID O-wasi Operating system: Wasi, Webassembly System Interface S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 9, 2025
@rust-log-analyzer

This comment has been minimized.

@thaliaarchi
Copy link
Contributor Author

@joboet Looks like you wrote #136780 to have minimum conflicts to this. Thanks for that. I don't mind rebasing onto that, if yours is merged first.

@Noratrieb
Copy link
Member

r? joboet

@rustbot rustbot assigned joboet and unassigned Noratrieb Feb 12, 2025
@thaliaarchi thaliaarchi changed the title Provide optional Read/Write method for stdio Provide optional Read/Write methods for stdio Feb 13, 2025
@thaliaarchi thaliaarchi force-pushed the io-optional-methods/stdio branch 2 times, most recently from f51bb4e to 118bb74 Compare February 16, 2025 21:59
@thaliaarchi
Copy link
Contributor Author

I dropped a few commits from this PR:

@thaliaarchi thaliaarchi marked this pull request as draft February 19, 2025 04:37
@thaliaarchi
Copy link
Contributor Author

Since this touches a lot of targets, I'm going to split this into multiple PRs for more target-focused review, once #136780 goes through the merge queue.

@joboet
Copy link
Member

joboet commented Feb 19, 2025

Since this touches a lot of targets, I'm going to split this into multiple PRs for more target-focused review, once #136780 goes through the merge queue.

That'd be great, thank you! Especially the SGX stuff would be much simpler to review as a dedicated PR.

@thaliaarchi thaliaarchi force-pushed the io-optional-methods/stdio branch from 118bb74 to ade071b Compare February 21, 2025 05:27
@rustbot rustbot added O-unix Operating system: Unix-like O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-windows Operating system: Windows labels Feb 21, 2025
@tgross35
Copy link
Contributor

Actually, the other PRs in that rollup all merged. This wouldn't make it into a rollup for a few hours, so might as well use that time to try again on top of everything else in case it interacted with another PR somehow.

@bors r-
@bors try

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 22, 2025
@bors
Copy link
Collaborator

bors commented Mar 22, 2025

⌛ Trying commit f6e90d8 with merge 533535a...

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 22, 2025
…o, r=<try>

Provide optional `Read`/`Write` methods for stdio

Override more of the default methods for `io::Read` and `io::Write` for stdio types, when efficient to do so, and deduplicate unsupported types.

Tracked in rust-lang#136756.

try-job: x86_64-msvc-1
@bors
Copy link
Collaborator

bors commented Mar 22, 2025

☀️ Try build successful - checks-actions
Build commit: 533535a (533535adca65287b0e54b123821057231cd51bc8)

@thaliaarchi
Copy link
Contributor Author

Probably just a spurious failure then?

@tgross35
Copy link
Contributor

I guess so, that’s just a weirdly specific failure to be spurious.

@bors r=joboet

@bors
Copy link
Collaborator

bors commented Mar 23, 2025

📌 Commit f6e90d8 has been approved by joboet

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 23, 2025
@bors
Copy link
Collaborator

bors commented Mar 23, 2025

⌛ Testing commit f6e90d8 with merge 60a3084...

@bors
Copy link
Collaborator

bors commented Mar 23, 2025

☀️ Test successful - checks-actions
Approved by: joboet
Pushing 60a3084 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 23, 2025
@bors bors merged commit 60a3084 into rust-lang:master Mar 23, 2025
7 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 23, 2025
Copy link

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing f08d5c0 (parent) -> 60a3084 (this PR)

Test differences

Show 60 test diffs

Additionally, 60 doctest diffs were found. These are ignored, as they are noisy.

Job group index

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (60a3084): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -3.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.1% [-3.1%, -3.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.1% [-3.1%, -3.1%] 1

Cycles

Results (secondary 3.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.7% [3.7%, 3.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 774.928s -> 774.048s (-0.11%)
Artifact size: 365.54 MiB -> 365.55 MiB (0.00%)

@thaliaarchi thaliaarchi deleted the io-optional-methods/stdio branch March 23, 2025 19:51
thaliaarchi added a commit to thaliaarchi/rust that referenced this pull request Mar 24, 2025
Currently, `write` for stdout and stderr is implemented with the
semantics of `write_all`. Instead, implement `write_all` and call the
underlying syscall only once in `write`. Also, implement
`write_vectored` by adding support for `IoSlice`.

Refactor stdin to reuse the unsupported type like rust-lang#136769.
thaliaarchi added a commit to thaliaarchi/rust that referenced this pull request Mar 24, 2025
Currently, `write` for stdout and stderr on Trusty is implemented with
the semantics of `write_all`. Instead, implement `write_all` and call
the underlying syscall only once in `write`. Also, implement
`write_vectored` by adding support for `IoSlice`.

Refactor stdin to reuse the unsupported type like rust-lang#136769.
thaliaarchi added a commit to thaliaarchi/rust that referenced this pull request Mar 24, 2025
Currently, `write` for stdout and stderr on Trusty is implemented with
the semantics of `write_all`. Instead, implement `write_all` and call
the underlying syscall only once in `write`. Also, implement
`write_vectored` by adding support for `IoSlice`.

Refactor stdin to reuse the unsupported type like rust-lang#136769.
thaliaarchi added a commit to thaliaarchi/rust that referenced this pull request Mar 27, 2025
Currently, `write` for stdout and stderr on Trusty is implemented with
the semantics of `write_all`. Instead, call the underlying syscall only
once in `write` and use the default implementation of `write_all` like
other platforms. Also, implement `write_vectored` by adding support for
`IoSlice`.

Refactor stdin to reuse the unsupported type like rust-lang#136769.
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Apr 2, 2025
…o, r=joboet

Provide optional `Read`/`Write` methods for stdio

Override more of the default methods for `io::Read` and `io::Write` for stdio types, when efficient to do so, and deduplicate unsupported types.

Tracked in rust-lang#136756.

try-job: x86_64-msvc-1
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 6, 2025
Trusty: Implement `write_vectored` for stdio

Currently, `write` for stdout and stderr on Trusty is implemented with the semantics of `write_all`. Instead, call the underlying syscall only once in `write` and use the default implementation of `write_all` like other platforms. Also, implement `write_vectored` by adding support for `IoSlice`.

Refactor stdin to reuse the unsupported type like rust-lang#136769.

It requires rust-lang#138875 to fix the build for Trusty, though they do not conflict and can merge in either order.

cc `@randomPoison`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 6, 2025
Rollup merge of rust-lang#138876 - thaliaarchi:trusty-stdio, r=Noratrieb

Trusty: Implement `write_vectored` for stdio

Currently, `write` for stdout and stderr on Trusty is implemented with the semantics of `write_all`. Instead, call the underlying syscall only once in `write` and use the default implementation of `write_all` like other platforms. Also, implement `write_vectored` by adding support for `IoSlice`.

Refactor stdin to reuse the unsupported type like rust-lang#136769.

It requires rust-lang#138875 to fix the build for Trusty, though they do not conflict and can merge in either order.

cc `@randomPoison`
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Apr 11, 2025
Currently, `write` for stdout and stderr on Trusty is implemented with
the semantics of `write_all`. Instead, call the underlying syscall only
once in `write` and use the default implementation of `write_all` like
other platforms. Also, implement `write_vectored` by adding support for
`IoSlice`.

Refactor stdin to reuse the unsupported type like rust-lang#136769.
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Apr 11, 2025
Trusty: Implement `write_vectored` for stdio

Currently, `write` for stdout and stderr on Trusty is implemented with the semantics of `write_all`. Instead, call the underlying syscall only once in `write` and use the default implementation of `write_all` like other platforms. Also, implement `write_vectored` by adding support for `IoSlice`.

Refactor stdin to reuse the unsupported type like rust-lang#136769.

It requires rust-lang#138875 to fix the build for Trusty, though they do not conflict and can merge in either order.

cc `@randomPoison`
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Apr 28, 2025
Trusty: Implement `write_vectored` for stdio

Currently, `write` for stdout and stderr on Trusty is implemented with the semantics of `write_all`. Instead, call the underlying syscall only once in `write` and use the default implementation of `write_all` like other platforms. Also, implement `write_vectored` by adding support for `IoSlice`.

Refactor stdin to reuse the unsupported type like rust-lang/rust#136769.

It requires #138875 to fix the build for Trusty, though they do not conflict and can merge in either order.

cc `@randomPoison`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants