- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
          [ACP 362] genericize ptr::from_raw_parts
          #125701
        
          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.
| Oh, the CI failure helpfully shows that anyone still having a cast gets a nice error suggesting 
 | 
9285c3c    to
    d2619ea      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
d2619ea    to
    0d63e6b      
    Compare
  
    
              
                    WaffleLapkin
  
              
              approved these changes
              
                  
                    May 29, 2024 
                  
              
              
            
            
| @bors r+ rollup | 
    
  fmease 
      added a commit
        to fmease/rust
      that referenced
      this pull request
    
      May 29, 2024 
    
    
      
  
    
      
    
  
…=WaffleLapkin [ACP 362] genericize `ptr::from_raw_parts` This implements rust-lang/libs-team#362 As such, it can partially undo rust-lang#124795 , letting `slice_from_raw_parts` just call `from_raw_parts` again without re-introducing the unnecessary cast to MIR. By doing this it also removes a spurious cast from `str::from_raw_parts`. And I think it does a good job of showing the value of the ACP, since the only thing that needed new turbofishing because of this is inside `ptr::null(_mut)`, but only because `ptr::without_provenance(_mut)` doesn't support pointers to extern types, which it absolutely could (without even changing the implementation).
  This was referenced May 29, 2024 
      
    
  bors 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      May 30, 2024 
    
    
      
  
    
      
    
  
Rollup of 7 pull requests Successful merges: - rust-lang#125653 (Migrate `run-make/const-prop-lint` to `rmake.rs`) - rust-lang#125662 (Rewrite `fpic`, `simple-dylib` and `issue-37893` `run-make` tests in `rmake.rs` or ui test format) - rust-lang#125699 (Streamline `x fmt` and improve its output) - rust-lang#125701 ([ACP 362] genericize `ptr::from_raw_parts`) - rust-lang#125723 (Migrate `run-make/crate-data-smoke` to `rmake.rs`) - rust-lang#125733 (Add lang items for `AsyncFn*`, `Future`, `AsyncFnKindHelper`'s associated types) - rust-lang#125734 (ast: Revert a breaking attribute visiting order change) r? `@ghost` `@rustbot` modify labels: rollup
    
  rust-timer 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      May 30, 2024 
    
    
      
  
    
      
    
  
Rollup merge of rust-lang#125701 - scottmcm:generic-from-raw-parts, r=WaffleLapkin [ACP 362] genericize `ptr::from_raw_parts` This implements rust-lang/libs-team#362 As such, it can partially undo rust-lang#124795 , letting `slice_from_raw_parts` just call `from_raw_parts` again without re-introducing the unnecessary cast to MIR. By doing this it also removes a spurious cast from `str::from_raw_parts`. And I think it does a good job of showing the value of the ACP, since the only thing that needed new turbofishing because of this is inside `ptr::null(_mut)`, but only because `ptr::without_provenance(_mut)` doesn't support pointers to extern types, which it absolutely could (without even changing the implementation).
    
  egkoppel 
      added a commit
        to popcorn-2/popcorn-2
      that referenced
      this pull request
    
      May 31, 2024 
    
    
  
  This was referenced Nov 11, 2024 
      
    
  matthiaskrgr 
      added a commit
        to matthiaskrgr/rust
      that referenced
      this pull request
    
      Nov 12, 2024 
    
    
      
  
    
      
    
  
…aw-parts, r=ibraheemdev Generalize `NonNull::from_raw_parts` per ACP362 I did the raw pointers in rust-lang#125701, but apparently forgot `NonNull`. cc rust-lang/libs-team#362
    
  rust-timer 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      Nov 12, 2024 
    
    
      
  
    
      
    
  
Rollup merge of rust-lang#132895 - scottmcm:generalize-nonnull-from-raw-parts, r=ibraheemdev Generalize `NonNull::from_raw_parts` per ACP362 I did the raw pointers in rust-lang#125701, but apparently forgot `NonNull`. cc rust-lang/libs-team#362
    
  stegaBOB 
      added a commit
        to stegaBOB/ptr_meta
      that referenced
      this pull request
    
      Apr 14, 2025 
    
    
  
  
    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. 
  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 implements rust-lang/libs-team#362
As such, it can partially undo #124795 , letting
slice_from_raw_partsjust callfrom_raw_partsagain without re-introducing the unnecessary cast to MIR.By doing this it also removes a spurious cast from
str::from_raw_parts. And I think it does a good job of showing the value of the ACP, since the only thing that needed new turbofishing because of this is insideptr::null(_mut), but only becauseptr::without_provenance(_mut)doesn't support pointers to extern types, which it absolutely could (without even changing the implementation).