- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
          Remove redundant union check in KnownPanicsLint const prop
          #124550
        
          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
    
  
  
    
    | Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt | 
              
                    gurry
  
              
              commented
              
                  
                    Apr 30, 2024 
                  
              
              
            
            
KnownPanicsLint const prop
      
              
                    oli-obk
  
              
              reviewed
              
                  
                    Apr 30, 2024 
                  
              
              
            
            
78f3f5c    to
    e0c73be      
    Compare
  
    because we are already marking unions `NoPropagation` in `CanConstProp::check()`. That is enough to prevent any attempts at const propagating unions and this second check is not needed. Also improve a comment in `CanConstProp::check()`
e0c73be    to
    741d40f      
    Compare
  
    | Thanks! @bors r+ rollup | 
    
  bors 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      Apr 30, 2024 
    
    
      
  
    
      
    
  
…iaskrgr Rollup of 3 pull requests Successful merges: - rust-lang#123247 (Mention Both HRTB and Generic Lifetime Param in `E0637` documentation) - rust-lang#124511 (Remove many `#[macro_use] extern crate foo` items) - rust-lang#124550 (Remove redundant union check in `KnownPanicsLint` const prop) r? `@ghost` `@rustbot` modify labels: rollup
    
  rust-timer 
      added a commit
        to rust-lang-ci/rust
      that referenced
      this pull request
    
      Apr 30, 2024 
    
    
      
  
    
      
    
  
Rollup merge of rust-lang#124550 - gurry:remove-redundant-code, r=oli-obk Remove redundant union check in `KnownPanicsLint` const prop Removes the below check which prevents unions from being const propagated:https://github.com/rust-lang/rust/blob/f9dca46218d4b8efa062aec4fd0820cbb4942aa2/compiler/rustc_mir_transform/src/known_panics_lint.rs#L587-L594 It is not needed because after PR rust-lang#124504 we mark unions as `NoPropagation` over here: https://github.com/rust-lang/rust/blob/f9dca46218d4b8efa062aec4fd0820cbb4942aa2/compiler/rustc_mir_transform/src/known_panics_lint.rs#L899-L902 which is enough to prevent them from being const propagated.
  
    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-compiler
  Relevant to the compiler 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.
  
    
  
    
Removes the below check which prevents unions from being const propagated:
rust/compiler/rustc_mir_transform/src/known_panics_lint.rs
Lines 587 to 594 in f9dca46
It is not needed because after PR #124504 we mark unions as
NoPropagationover here:rust/compiler/rustc_mir_transform/src/known_panics_lint.rs
Lines 899 to 902 in f9dca46