- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
          Windows: make read_dir stop iterating after the first error is encountered
          #142453
        
          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
          
     Merged
      
      
    Conversation
  
    
      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
    
  
  
    
    | r? @ibraheemdev rustbot has assigned @ibraheemdev. Use  | 
| This makes sense to me, but I'd like someone from libs-api to take a look. r? libs-api | 
| @bors r+ | 
    
  workingjubilee 
      added a commit
        to workingjubilee/rustc
      that referenced
      this pull request
    
      Jun 24, 2025 
    
    
      
  
    
      
    
  
Windows: make `read_dir` stop iterating after the first error is encountered This also essentially makes the `ReadDir` iterator fused. Which I think is pretty much what people expect anyway. [`FindNextFileW`](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findnextfilew) doesn't document what happens if you call it after iteration ends or after an error so we're probably in implementation defined territory at that point.
    
  workingjubilee 
      added a commit
        to workingjubilee/rustc
      that referenced
      this pull request
    
      Jun 25, 2025 
    
    
      
  
    
      
    
  
Windows: make `read_dir` stop iterating after the first error is encountered This also essentially makes the `ReadDir` iterator fused. Which I think is pretty much what people expect anyway. [`FindNextFileW`](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findnextfilew) doesn't document what happens if you call it after iteration ends or after an error so we're probably in implementation defined territory at that point.
  This was referenced Jun 25, 2025 
      
    
  bors 
      added a commit
      that referenced
      this pull request
    
      Jun 25, 2025 
    
    
      
  
    
      
    
  
Rollup of 15 pull requests Successful merges: - #135731 (Implement parsing of pinned borrows) - #138780 (Add `#[loop_match]` for improved DFA codegen) - #142453 (Windows: make `read_dir` stop iterating after the first error is encountered) - #142633 (Error on invalid signatures for interrupt ABIs) - #142768 (Avoid a bitcast FFI call in transmuting) - #142825 (Port `#[track_caller]` to the new attribute system) - #142844 (Enable short-ice for Windows) - #142934 (Tweak `-Zmacro-stats` measurement.) - #142955 (Couple of test suite fixes for cg_clif) - #142977 (rustdoc: Don't mark `#[target_feature]` functions as ⚠) - #142980 (Reduce mismatched-lifetime-syntaxes suggestions to MaybeIncorrect) - #142982 (Corrected spelling mistake in c_str.rs) - #142983 (Taint body on invalid call ABI) - #142988 (Update wasm-component-ld to 0.5.14) - #142993 (Update cargo) r? `@ghost` `@rustbot` modify labels: rollup
    
  rust-timer 
      added a commit
      that referenced
      this pull request
    
      Jun 25, 2025 
    
    
      
  
    
      
    
  
Rollup merge of #142453 - ChrisDenton:fused, r=Amanieu Windows: make `read_dir` stop iterating after the first error is encountered This also essentially makes the `ReadDir` iterator fused. Which I think is pretty much what people expect anyway. [`FindNextFileW`](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findnextfilew) doesn't document what happens if you call it after iteration ends or after an error so we're probably in implementation defined territory at that point.
    
  flip1995 
      pushed a commit
        to flip1995/rust-clippy
      that referenced
      this pull request
    
      Jun 26, 2025 
    
    
      
  
    
      
    
  
Rollup of 15 pull requests Successful merges: - rust-lang/rust#135731 (Implement parsing of pinned borrows) - rust-lang/rust#138780 (Add `#[loop_match]` for improved DFA codegen) - rust-lang/rust#142453 (Windows: make `read_dir` stop iterating after the first error is encountered) - rust-lang/rust#142633 (Error on invalid signatures for interrupt ABIs) - rust-lang/rust#142768 (Avoid a bitcast FFI call in transmuting) - rust-lang/rust#142825 (Port `#[track_caller]` to the new attribute system) - rust-lang/rust#142844 (Enable short-ice for Windows) - rust-lang/rust#142934 (Tweak `-Zmacro-stats` measurement.) - rust-lang/rust#142955 (Couple of test suite fixes for cg_clif) - rust-lang/rust#142977 (rustdoc: Don't mark `#[target_feature]` functions as ⚠) - rust-lang/rust#142980 (Reduce mismatched-lifetime-syntaxes suggestions to MaybeIncorrect) - rust-lang/rust#142982 (Corrected spelling mistake in c_str.rs) - rust-lang/rust#142983 (Taint body on invalid call ABI) - rust-lang/rust#142988 (Update wasm-component-ld to 0.5.14) - rust-lang/rust#142993 (Update cargo) r? `@ghost` `@rustbot` modify labels: rollup
    
  tautschnig 
      pushed a commit
        to model-checking/verify-rust-std
      that referenced
      this pull request
    
      Jul 3, 2025 
    
    
      
  
    
      
    
  
Windows: make `read_dir` stop iterating after the first error is encountered This also essentially makes the `ReadDir` iterator fused. Which I think is pretty much what people expect anyway. [`FindNextFileW`](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findnextfilew) doesn't document what happens if you call it after iteration ends or after an error so we're probably in implementation defined territory at that point.
    
  tautschnig 
      pushed a commit
        to model-checking/verify-rust-std
      that referenced
      this pull request
    
      Jul 3, 2025 
    
    
      
  
    
      
    
  
…kingjubilee Rollup of 15 pull requests Successful merges: - rust-lang#135731 (Implement parsing of pinned borrows) - rust-lang#138780 (Add `#[loop_match]` for improved DFA codegen) - rust-lang#142453 (Windows: make `read_dir` stop iterating after the first error is encountered) - rust-lang#142633 (Error on invalid signatures for interrupt ABIs) - rust-lang#142768 (Avoid a bitcast FFI call in transmuting) - rust-lang#142825 (Port `#[track_caller]` to the new attribute system) - rust-lang#142844 (Enable short-ice for Windows) - rust-lang#142934 (Tweak `-Zmacro-stats` measurement.) - rust-lang#142955 (Couple of test suite fixes for cg_clif) - rust-lang#142977 (rustdoc: Don't mark `#[target_feature]` functions as ⚠) - rust-lang#142980 (Reduce mismatched-lifetime-syntaxes suggestions to MaybeIncorrect) - rust-lang#142982 (Corrected spelling mistake in c_str.rs) - rust-lang#142983 (Taint body on invalid call ABI) - rust-lang#142988 (Update wasm-component-ld to 0.5.14) - rust-lang#142993 (Update cargo) 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
      
    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. 
  
    T-libs-api
  Relevant to the library API 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.
  
    
  
    
This also essentially makes the
ReadDiriterator fused. Which I think is pretty much what people expect anyway.FindNextFileWdoesn't document what happens if you call it after iteration ends or after an error so we're probably in implementation defined territory at that point.Fixes #142411