- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
          Start using with_native_path in std::sys::fs
          #138832
        
          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
      
      
    
                
     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
    
  
  
    
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
98ace21    to
    b7e9898      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
b7e9898    to
    582d6ee      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
582d6ee    to
    265ee9c      
    Compare
  
    
              
                    joboet
  
              
              approved these changes
              
                  
                    Mar 28, 2025 
                  
              
              
            
            
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! If you want to convert some more functions here, that's fine with me, otherwise r=me
| @bors r+ | 
    
  jhpratt 
      added a commit
        to jhpratt/rust
      that referenced
      this pull request
    
      Mar 29, 2025 
    
    
      
  
    
      
    
  
…boet Start using `with_native_path` in `std::sys::fs` Ideally, each platform should use their own native path type internally. This will, for example, allow passing a `CStr` directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated C string. However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this PR does some minimal refactoring which should help progress towards that goal. The changes are Unix-only and even then I avoided functions that require more changes so that this PR is just moving things around. r? joboet
    
  bors 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      Mar 29, 2025 
    
    
      
  
    
      
    
  
Rollup of 8 pull requests Successful merges: - rust-lang#138692 (Reject `{true,false}` as revision names) - rust-lang#138757 (wasm: increase default thread stack size to 1 MB) - rust-lang#138832 (Start using `with_native_path` in `std::sys::fs`) - rust-lang#138988 (Change the syntax of the internal `weak!` macro) - rust-lang#139044 (bootstrap: Avoid cloning `change-id` list) - rust-lang#139056 (use `try_fold` instead of `fold`) - rust-lang#139057 (use `slice::contains` where applicable) - rust-lang#139086 (Various cleanup in ExprUseVisitor) r? `@ghost` `@rustbot` modify labels: rollup
265ee9c    to
    89c9c21      
    Compare
  
    | Just two minor fixes for platforms I missed (fuchsia and netbsd). | 
| @bors r=joboet | 
    
  matthiaskrgr 
      added a commit
        to matthiaskrgr/rust
      that referenced
      this pull request
    
      Mar 29, 2025 
    
    
      
  
    
      
    
  
…boet Start using `with_native_path` in `std::sys::fs` Ideally, each platform should use their own native path type internally. This will, for example, allow passing a `CStr` directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated C string. However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this PR does some minimal refactoring which should help progress towards that goal. The changes are Unix-only and even then I avoided functions that require more changes so that this PR is just moving things around. r? joboet
    
  bors 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      Mar 29, 2025 
    
    
      
  
    
      
    
  
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#137928 (stabilize const_cell) - rust-lang#138431 (Fix `uclibc` LLVM target triples) - rust-lang#138832 (Start using `with_native_path` in `std::sys::fs`) - rust-lang#139060 (replace commit placeholder in vendor status with actual commit) - rust-lang#139081 (std: deduplicate `errno` accesses) - rust-lang#139100 (compiletest: Support matching diagnostics on lines below) - rust-lang#139105 (`BackendRepr::is_signed`: comment why this may panics) - rust-lang#139106 (Mark .pp files as Rust) r? `@ghost` `@rustbot` modify labels: rollup
    
  bors 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      Mar 29, 2025 
    
    
      
  
    
      
    
  
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#137928 (stabilize const_cell) - rust-lang#138431 (Fix `uclibc` LLVM target triples) - rust-lang#138832 (Start using `with_native_path` in `std::sys::fs`) - rust-lang#139081 (std: deduplicate `errno` accesses) - rust-lang#139100 (compiletest: Support matching diagnostics on lines below) - rust-lang#139105 (`BackendRepr::is_signed`: comment why this may panics) - rust-lang#139106 (Mark .pp files as Rust) r? `@ghost` `@rustbot` modify labels: rollup
    
  rust-timer 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      Mar 30, 2025 
    
    
      
  
    
      
    
  
Rollup merge of rust-lang#138832 - ChrisDenton:with_native_path, r=joboet Start using `with_native_path` in `std::sys::fs` Ideally, each platform should use their own native path type internally. This will, for example, allow passing a `CStr` directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated C string. However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this PR does some minimal refactoring which should help progress towards that goal. The changes are Unix-only and even then I avoided functions that require more changes so that this PR is just moving things around. r? joboet
    
  github-actions bot
      pushed a commit
        to model-checking/verify-rust-std
      that referenced
      this pull request
    
      Apr 2, 2025 
    
    
      
  
    
      
    
  
…boet Start using `with_native_path` in `std::sys::fs` Ideally, each platform should use their own native path type internally. This will, for example, allow passing a `CStr` directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated C string. However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this PR does some minimal refactoring which should help progress towards that goal. The changes are Unix-only and even then I avoided functions that require more changes so that this PR is just moving things around. r? joboet
    
  github-actions bot
      pushed a commit
        to model-checking/verify-rust-std
      that referenced
      this pull request
    
      Apr 2, 2025 
    
    
      
  
    
      
    
  
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#137928 (stabilize const_cell) - rust-lang#138431 (Fix `uclibc` LLVM target triples) - rust-lang#138832 (Start using `with_native_path` in `std::sys::fs`) - rust-lang#139081 (std: deduplicate `errno` accesses) - rust-lang#139100 (compiletest: Support matching diagnostics on lines below) - rust-lang#139105 (`BackendRepr::is_signed`: comment why this may panics) - rust-lang#139106 (Mark .pp files as Rust) r? `@ghost` `@rustbot` modify labels: rollup
    
  bors 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      Apr 11, 2025 
    
    
      
  
    
      
    
  
…try> Use `with_native_path` for Windows Ideally, each platform should use their own native path type internally. This will, for example, allow passing a UTF-16 string directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated wide string. However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this just does some of the Windows parts. As with the previous Unix PR (rust-lang#138832) this is intended to be merely a refactoring so I've avoided anything that may require more substantial changes. try-job: x86_64-msvc-1
    
  jieyouxu 
      added a commit
        to jieyouxu/rust
      that referenced
      this pull request
    
      Apr 11, 2025 
    
    
      
  
    
      
    
  
…=tgross35,joboet Use `with_native_path` for Windows Ideally, each platform should use their own native path type internally. This will, for example, allow passing a UTF-16 string directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated wide string. However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this just does some of the Windows parts. As with the previous Unix PR (rust-lang#138832) this is intended to be merely a refactoring so I've avoided anything that may require more substantial changes.
    
  ChrisDenton 
      added a commit
        to ChrisDenton/rust
      that referenced
      this pull request
    
      Apr 13, 2025 
    
    
      
  
    
      
    
  
…=tgross35,joboet Use `with_native_path` for Windows Ideally, each platform should use their own native path type internally. This will, for example, allow passing a UTF-16 string directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated wide string. However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this just does some of the Windows parts. As with the previous Unix PR (rust-lang#138832) this is intended to be merely a refactoring so I've avoided anything that may require more substantial changes.
    
  ChrisDenton 
      added a commit
        to ChrisDenton/rust
      that referenced
      this pull request
    
      Apr 13, 2025 
    
    
      
  
    
      
    
  
…=tgross35,joboet Use `with_native_path` for Windows Ideally, each platform should use their own native path type internally. This will, for example, allow passing a UTF-16 string directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated wide string. However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this just does some of the Windows parts. As with the previous Unix PR (rust-lang#138832) this is intended to be merely a refactoring so I've avoided anything that may require more substantial changes.
    
  rust-timer 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      Apr 13, 2025 
    
    
      
  
    
      
    
  
Rollup merge of rust-lang#139683 - ChrisDenton:windows-with-native, r=tgross35,joboet Use `with_native_path` for Windows Ideally, each platform should use their own native path type internally. This will, for example, allow passing a UTF-16 string directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated wide string. However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this just does some of the Windows parts. As with the previous Unix PR (rust-lang#138832) this is intended to be merely a refactoring so I've avoided anything that may require more substantial changes.
    
  github-actions bot
      pushed a commit
        to model-checking/verify-rust-std
      that referenced
      this pull request
    
      Apr 19, 2025 
    
    
      
  
    
      
    
  
…=tgross35,joboet Use `with_native_path` for Windows Ideally, each platform should use their own native path type internally. This will, for example, allow passing a UTF-16 string directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated wide string. However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this just does some of the Windows parts. As with the previous Unix PR (rust-lang#138832) this is intended to be merely a refactoring so I've avoided anything that may require more substantial changes.
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      Labels
      
    O-unix
  Operating system: Unix-like 
  
    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.
  
    
  
    
Ideally, each platform should use their own native path type internally. This will, for example, allow passing a
CStrdirectly tostd::fs::File::openand therefore avoid the need for allocating a new null-terminated C string.However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this PR does some minimal refactoring which should help progress towards that goal. The changes are Unix-only and even then I avoided functions that require more changes so that this PR is just moving things around.
r? joboet