Skip to content

Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt - #162875

Open
json420 wants to merge 1 commit into
rust-lang:mainfrom
json420:seek_read_exact
Open

json420 wants to merge 1 commit into
rust-lang:mainfrom
json420:seek_read_exact

Conversation

@json420

@json420 json420 commented Sep 16, 2026

Copy link
Copy Markdown

View all comments

Tracking issue: #162868

This adds .seek_read_exact() to std::os::windows::fs::FileExt, an exact port of read_exact_at() for std::os::unix::fs::FileExt.

And it adds .seek_write_all() to std::os::windows::fs::FileExt, an exact port of write_all_at() for std::os::unix::fs::FileExt.

Finally, it adds six tests.

First there is a smoke test for seek_read_exact(), seek_write_all(), an exact port of the test for the .seek_read(), .seek_write() methods. This is to make sure we are getting the same pass-through behavior through the lens of established tests.

Then there are five tests for the windows::fs::FileExt trait itself, covering all seek_read_exact(), seek_write_all() corner cases except io::ErrorKind::Interrupted (advise welcome on that one). These tests use mock implementations of the traits seek_read() and seek_write() methods.

No LLMs were used in writing this PR.

@rustbot rustbot added O-windows Operating system: Windows 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 Sep 16, 2026
@rustbot

rustbot commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @clarfonthey (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions and our LLM policy for more information.

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from 6 candidates

Comment thread library/std/src/fs/tests.rs
@clarfonthey

Copy link
Copy Markdown
Contributor

LGTM minus test splitting.

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 17, 2026
@rustbot

rustbot commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@json420
json420 marked this pull request as draft September 17, 2026 21:50
@json420
json420 marked this pull request as ready for review September 18, 2026 19:11
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 18, 2026
@json420

json420 commented Sep 18, 2026

Copy link
Copy Markdown
Author

@rustbot ready

@clarfonthey

Copy link
Copy Markdown
Contributor

@bors r+ rollup

Thank you!

@rust-bors

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 6ac2b72 has been approved by clarfonthey

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 18, 2026
@json420

json420 commented Sep 18, 2026

Copy link
Copy Markdown
Author

@clarfonthey No, thank you! Contributing to Rust is, like, a wildly pleasant experience for a first timer! Seriously. Thanks!

Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 19, 2026
…they

Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt

Tracking issue: rust-lang#162868

This adds `.seek_read_exact()` to `std::os::windows::fs::FileExt`, an exact port of `read_exact_at()` for `std::os::unix::fs::FileExt`.

And it adds `.seek_write_all()` to `std::os::windows::fs::FileExt`, an exact port of `write_all_at()` for `std::os::unix::fs::FileExt`.

Finally, it adds six tests.

First there is a smoke test for `seek_read_exact()`, `seek_write_all()`, an exact port of the test for the  `.seek_read()`, `.seek_write()` methods. This is to make sure we are getting the same pass-through behavior through the lens of established tests.

Then there are five tests for the `windows::fs::FileExt` trait itself, covering all `seek_read_exact()`, `seek_write_all()` corner cases except  `io::ErrorKind::Interrupted` (advise welcome on that one). These tests use mock implementations of the traits `seek_read()` and `seek_write()` methods.

No LLMs were used in writing this PR.
rust-bors Bot pushed a commit that referenced this pull request Sep 19, 2026
Rollup of 18 pull requests

Successful merges:

 - #162499 (`rustc_codegen_gcc` subtree update)
 - #161424 (implement `VaArgSafe` for `f128`)
 - #161777 (Add Natvis visualiser and debuginfo tests for `f128`)
 - #162506 (Avoid suggesting imports of traits declared inside fn bodies)
 - #162591 (Move parse error recovery for expression operators "out of line" & refactor in the area)
 - #162669 ([rustdoc] Correctly handle intra-doc links on inlined same item with different names)
 - #162733 (Add useful APIs to `Unique(Arc|Rc)`)
 - #162913 (Refactor LivenessResults into LivenessComputation, without typeck)
 - #162950 (More AST lowering cleanups)
 - #162964 (Update `browser-ui-test` version to `0.25.2`)
 - #162979 (mark `f128` as reliable on `powerpc64` with `+vsx`)
 - #161743 (Add performance notes for the floating-point round method)
 - #162797 (yeet AliasConstKind::opt_def_id)
 - #162836 (Ping T-libs-ping instead of T-libs-fcp for backports)
 - #162873 (Adjust `bug!`/`span_bug!` emission)
 - #162875 (Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt)
 - #162956 (Add missing `#[repr(C)]` in UI, codegen and assembly tests)
 - #162981 (rustc-dev-guide subtree update)

Failed merges:

 - #162177 (Properly implement the gpu-kernel ABI for amdgpu)
rust-bors Bot pushed a commit that referenced this pull request Sep 19, 2026
Rollup of 18 pull requests

Successful merges:

 - #162499 (`rustc_codegen_gcc` subtree update)
 - #161424 (implement `VaArgSafe` for `f128`)
 - #161777 (Add Natvis visualiser and debuginfo tests for `f128`)
 - #162506 (Avoid suggesting imports of traits declared inside fn bodies)
 - #162591 (Move parse error recovery for expression operators "out of line" & refactor in the area)
 - #162669 ([rustdoc] Correctly handle intra-doc links on inlined same item with different names)
 - #162733 (Add useful APIs to `Unique(Arc|Rc)`)
 - #162913 (Refactor LivenessResults into LivenessComputation, without typeck)
 - #162950 (More AST lowering cleanups)
 - #162964 (Update `browser-ui-test` version to `0.25.2`)
 - #162979 (mark `f128` as reliable on `powerpc64` with `+vsx`)
 - #161743 (Add performance notes for the floating-point round method)
 - #162797 (yeet AliasConstKind::opt_def_id)
 - #162836 (Ping T-libs-ping instead of T-libs-fcp for backports)
 - #162873 (Adjust `bug!`/`span_bug!` emission)
 - #162875 (Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt)
 - #162956 (Add missing `#[repr(C)]` in UI, codegen and assembly tests)
 - #162981 (rustc-dev-guide subtree update)

Failed merges:

 - #162177 (Properly implement the gpu-kernel ABI for amdgpu)
@JonathanBrouwer

Copy link
Copy Markdown
Member

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #162996 (comment)

@rust-bors rust-bors Bot 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 Sep 19, 2026
@rust-bors

rust-bors Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#162996), which was unapproved.

View changes since this unapproval

@clarfonthey

Copy link
Copy Markdown
Contributor

@bors try test-x86_64-msvc-1

@clarfonthey

Copy link
Copy Markdown
Contributor

@bors delegate try

even though I don't think you'll need it again, assuming you did fix it

@rust-bors

rust-bors Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

✌️ @json420, you can now perform try builds on this pull request!

You can now post @bors try to start a try build.

@rust-bors

rust-bors Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: de6c0ea (de6c0eabfc2cc9c904ad1d07b2d8e23b0fd9b042)
Base parent: 36b04f3 (36b04f3ad12a98b1a3cf9efe5313306ef7d5848d)

@clarfonthey

Copy link
Copy Markdown
Contributor

@bors r+ rollup

Second try's a charm!

@rust-bors

rust-bors Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d80ee2c has been approved by clarfonthey

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Sep 19, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 19, 2026
…they

Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt

Tracking issue: rust-lang#162868

This adds `.seek_read_exact()` to `std::os::windows::fs::FileExt`, an exact port of `read_exact_at()` for `std::os::unix::fs::FileExt`.

And it adds `.seek_write_all()` to `std::os::windows::fs::FileExt`, an exact port of `write_all_at()` for `std::os::unix::fs::FileExt`.

Finally, it adds six tests.

First there is a smoke test for `seek_read_exact()`, `seek_write_all()`, an exact port of the test for the  `.seek_read()`, `.seek_write()` methods. This is to make sure we are getting the same pass-through behavior through the lens of established tests.

Then there are five tests for the `windows::fs::FileExt` trait itself, covering all `seek_read_exact()`, `seek_write_all()` corner cases except  `io::ErrorKind::Interrupted` (advise welcome on that one). These tests use mock implementations of the traits `seek_read()` and `seek_write()` methods.

No LLMs were used in writing this PR.
rust-bors Bot pushed a commit that referenced this pull request Sep 19, 2026
Rollup of 13 pull requests

Successful merges:

 - #158515 (Make let-else respect macro_rules expr metavariable grouping)
 - #160097 (fix const_item_mutation lint to use needs_drop instead of has_dtor)
 - #161435 (Provide a `supertrait_def_ids()` function in rustc_type_ir's interner)
 - #161894 (Do not suppress the fn item uniqueness note for late bound lifetimes)
 - #162990 (post GH comment on types nominations)
 - #154665 (add safety section for mem::zeroed)
 - #162700 ( Remove incorrect parse error recovery code that mistakes `as` casts for the long removed type ascription)
 - #162705 (Trigger "C array" parse error recovery in far fewer cases)
 - #162875 (Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt)
 - #162988 (recover `true` and `false` in type position as `bool`)
 - #162995 (Constify `impl FromStr for NonZero<T>`)
 - #163006 (Use `end_point` for trailing brace in `let...else` diagnostics)
 - #163007 (add Dir::try_clone)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 19, 2026
…they

Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt

Tracking issue: rust-lang#162868

This adds `.seek_read_exact()` to `std::os::windows::fs::FileExt`, an exact port of `read_exact_at()` for `std::os::unix::fs::FileExt`.

And it adds `.seek_write_all()` to `std::os::windows::fs::FileExt`, an exact port of `write_all_at()` for `std::os::unix::fs::FileExt`.

Finally, it adds six tests.

First there is a smoke test for `seek_read_exact()`, `seek_write_all()`, an exact port of the test for the  `.seek_read()`, `.seek_write()` methods. This is to make sure we are getting the same pass-through behavior through the lens of established tests.

Then there are five tests for the `windows::fs::FileExt` trait itself, covering all `seek_read_exact()`, `seek_write_all()` corner cases except  `io::ErrorKind::Interrupted` (advise welcome on that one). These tests use mock implementations of the traits `seek_read()` and `seek_write()` methods.

No LLMs were used in writing this PR.
rust-bors Bot pushed a commit that referenced this pull request Sep 19, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #158515 (Make let-else respect macro_rules expr metavariable grouping)
 - #162726 (std: fix unix socket address panic on a full sun_path)
 - #160028 (Better account for `Self` that might be a typo of `self`)
 - #160097 (fix const_item_mutation lint to use needs_drop instead of has_dtor)
 - #161435 (Provide a `supertrait_def_ids()` function in rustc_type_ir's interner)
 - #161894 (Do not suppress the fn item uniqueness note for late bound lifetimes)
 - #162990 (post GH comment on types nominations)
 - #154665 (add safety section for mem::zeroed)
 - #162700 ( Remove incorrect parse error recovery code that mistakes `as` casts for the long removed type ascription)
 - #162705 (Trigger "C array" parse error recovery in far fewer cases)
 - #162875 (Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt)
 - #162988 (recover `true` and `false` in type position as `bool`)
 - #162995 (Constify `impl FromStr for NonZero<T>`)
 - #163006 (Use `end_point` for trailing brace in `let...else` diagnostics)
 - #163007 (add Dir::try_clone)
@fmease

fmease commented Sep 19, 2026

Copy link
Copy Markdown
Member

Could you squash away the fixup & micro commits? I'm talking about commits like the "whitespace" & the "period" one. 20 commits is tad much in this case. Thanks for your understanding!

@bors r-

@rust-bors rust-bors Bot 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 Sep 19, 2026
@rust-bors

rust-bors Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#163038), which was unapproved.

View changes since this unapproval

@clarfonthey

Copy link
Copy Markdown
Contributor

@bors squash

@rust-bors

This comment has been minimized.

…leExt

* First pass at windows::fs::FileExt.seek_read_exact()
* First pass at windows::fs::FileExt.seek_write_all()
* Fix function signature in seek_read_exact(), duh
* First pass at tests for .seek_read_exact(), seek_write_all()
* Whitespace fix
* Use hypothetical seek_read_exact_seek_write_all feature also for .seek_read_exact()
* Tracking issues 162868
* Oops, fix seek_write_all() doc example, was using write_all_at() still
* Add mocked test for windows FileExt trait
* Spelling fixes
* Expand test for windows FileExt trait to include almost all scenarios
* Split three tests out of file_test_windows_fileext_trait()
* Remove old versions of those 3 tests
* Split remaining file_test_windows_fileext_trait() into case 4, 5
* More test cleanup, always test expected_offset where possible
* Test read first for consistency
* Use same doctsring examples as seek_read(), seek_write()
* Missing period
* Oops: actually call _exact(), _all() methods in case 2, 3
* Add missing seek_read_exact_seek_write_all feature flags in doc examples
@rust-bors

rust-bors Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

🔨 20 commits were squashed into 837ce84.

This PR was contained in a rollup (#163038), which was closed.

@clarfonthey

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 837ce84 has been approved by clarfonthey

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Sep 20, 2026
mu001999 added a commit to mu001999/rust that referenced this pull request Sep 20, 2026
…they

Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt

Tracking issue: rust-lang#162868

This adds `.seek_read_exact()` to `std::os::windows::fs::FileExt`, an exact port of `read_exact_at()` for `std::os::unix::fs::FileExt`.

And it adds `.seek_write_all()` to `std::os::windows::fs::FileExt`, an exact port of `write_all_at()` for `std::os::unix::fs::FileExt`.

Finally, it adds six tests.

First there is a smoke test for `seek_read_exact()`, `seek_write_all()`, an exact port of the test for the  `.seek_read()`, `.seek_write()` methods. This is to make sure we are getting the same pass-through behavior through the lens of established tests.

Then there are five tests for the `windows::fs::FileExt` trait itself, covering all `seek_read_exact()`, `seek_write_all()` corner cases except  `io::ErrorKind::Interrupted` (advise welcome on that one). These tests use mock implementations of the traits `seek_read()` and `seek_write()` methods.

No LLMs were used in writing this PR.
rust-bors Bot pushed a commit that referenced this pull request Sep 20, 2026
Rollup of 17 pull requests

Successful merges:

 - #158515 (Make let-else respect macro_rules expr metavariable grouping)
 - #160028 (Better account for `Self` that might be a typo of `self`)
 - #160097 (fix const_item_mutation lint to use needs_drop instead of has_dtor)
 - #161435 (Provide a `supertrait_def_ids()` function in rustc_type_ir's interner)
 - #161894 (Do not suppress the fn item uniqueness note for late bound lifetimes)
 - #162990 (post GH comment on types nominations)
 - #153662 (Suggest fully qualified path on method name collision)
 - #154665 (add safety section for mem::zeroed)
 - #159787 (Prefer ModId in more places)
 - #162700 ( Remove incorrect parse error recovery code that mistakes `as` casts for the long removed type ascription)
 - #162705 (Trigger "C array" parse error recovery in far fewer cases)
 - #162875 (Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt)
 - #162988 (recover `true` and `false` in type position as `bool`)
 - #162995 (Constify `impl FromStr for NonZero<T>`)
 - #163006 (Use `end_point` for trailing brace in `let...else` diagnostics)
 - #163007 (add Dir::try_clone)
 - #163039 (Use verbose suggestion for parenthetical `Fn` notation and fully-qualified path on ambiguous assoc item)
rust-bors Bot pushed a commit that referenced this pull request Sep 20, 2026
Rollup of 17 pull requests

Successful merges:

 - #158515 (Make let-else respect macro_rules expr metavariable grouping)
 - #160028 (Better account for `Self` that might be a typo of `self`)
 - #160097 (fix const_item_mutation lint to use needs_drop instead of has_dtor)
 - #161435 (Provide a `supertrait_def_ids()` function in rustc_type_ir's interner)
 - #161894 (Do not suppress the fn item uniqueness note for late bound lifetimes)
 - #162990 (post GH comment on types nominations)
 - #153662 (Suggest fully qualified path on method name collision)
 - #154665 (add safety section for mem::zeroed)
 - #159787 (Prefer ModId in more places)
 - #162700 ( Remove incorrect parse error recovery code that mistakes `as` casts for the long removed type ascription)
 - #162705 (Trigger "C array" parse error recovery in far fewer cases)
 - #162875 (Add .seek_read_exact(), .seek_write_all() to std::os::windows::fs::FileExt)
 - #162988 (recover `true` and `false` in type position as `bool`)
 - #162995 (Constify `impl FromStr for NonZero<T>`)
 - #163006 (Use `end_point` for trailing brace in `let...else` diagnostics)
 - #163007 (add Dir::try_clone)
 - #163039 (Use verbose suggestion for parenthetical `Fn` notation and fully-qualified path on ambiguous assoc item)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-windows Operating system: Windows 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.

6 participants