- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Fix ICE-133117: multiple never-pattern arm doesn't have false_edge_start_block #135409
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
      
      
            bors
  merged 8 commits into
  rust-lang:master
from
Shunpoco:issue-133117-ICE-never-false-edge-start-block
  
      
      
   
  Jan 23, 2025 
      
    
  
     Merged
                    Changes from 4 commits
      Commits
    
    
            Show all changes
          
          
            8 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      3a83422
              
                Fix ICE-133063
              
              
                Shunpoco 8a57fa6
              
                Fix ICE-133117
              
              
                Shunpoco 8c0c149
              
                Remove solved crashes
              
              
                Shunpoco 0385dd4
              
                Fix ICE-130779
              
              
                Shunpoco e7db092
              
                address review: modify ICE-133117-duplicated-never-arm.rs
              
              
                Shunpoco d8a216b
              
                address review: modify ICE-133063-never-arm-no-otherwise-block.rs
              
              
                Shunpoco 481ed2d
              
                address review: modify matches/mod.rs
              
              
                Shunpoco 7275bdf
              
                modify comment
              
              
                Shunpoco File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      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 file was deleted.
      
      Oops, something went wrong.
      
    
  This file was deleted.
      
      Oops, something went wrong.
      
    
  This file was deleted.
      
      Oops, something went wrong.
      
    
  
        
          
          
            12 changes: 12 additions & 0 deletions
          
          12 
        
  tests/ui/rfcs/rfc-0000-never_patterns/ICE-130779-never-arm-no-oatherwise-block.rs
  
  
      
      
   
        
      
      
    
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #![feature(never_patterns)] | ||
| #![allow(incomplete_features)] | ||
| 
     | 
||
| enum E { A } | ||
| 
     | 
||
| fn main() { | ||
| match E::A { | ||
| ! | //~ ERROR: a trailing `|` is not allowed in an or-pattern | ||
| //~^ ERROR: mismatched types | ||
| if true => {} //~ ERROR: a never pattern is always unreachable | ||
| } | ||
| } | 
        
          
          
            33 changes: 33 additions & 0 deletions
          
          33 
        
  tests/ui/rfcs/rfc-0000-never_patterns/ICE-130779-never-arm-no-oatherwise-block.stderr
  
  
      
      
   
        
      
      
    
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| error: a trailing `|` is not allowed in an or-pattern | ||
| --> $DIR/ICE-130779-never-arm-no-oatherwise-block.rs:8:11 | ||
| | | ||
| LL | ! | | ||
| | - ^ | ||
| | | | ||
| | while parsing this or-pattern starting here | ||
| | | ||
| help: remove the `|` | ||
| | | ||
| LL - ! | | ||
| LL + ! | ||
| | | ||
| 
     | 
||
| error: a never pattern is always unreachable | ||
| --> $DIR/ICE-130779-never-arm-no-oatherwise-block.rs:10:20 | ||
| | | ||
| LL | if true => {} | ||
| | ^^ | ||
| | | | ||
| | this will never be executed | ||
| | help: remove this expression | ||
| 
     | 
||
| error: mismatched types | ||
| --> $DIR/ICE-130779-never-arm-no-oatherwise-block.rs:8:9 | ||
| | | ||
| LL | ! | | ||
| | ^ a never pattern must be used on an uninhabited type | ||
| | | ||
| = note: the matched value is of type `E` | ||
| 
     | 
||
| error: aborting due to 3 previous errors | ||
| 
     | 
        
          
          
            21 changes: 21 additions & 0 deletions
          
          21 
        
  tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.rs
  
  
      
      
   
        
      
      
    
  
    
      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
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #![feature(never_patterns)] | ||
| #![feature(if_let_guard)] | ||
| #![allow(incomplete_features)] | ||
| 
     | 
||
| fn split_last(_: &()) -> Option<(&i32, &i32)> { | ||
| None | ||
| } | ||
| 
     | 
||
| fn assign_twice() { | ||
| loop { | ||
| match () { | ||
| (!| //~ ERROR: mismatched types | ||
| !) if let _ = split_last(&()) => {} //~ ERROR a never pattern is always unreachable | ||
| //~^ ERROR: mismatched types | ||
| //~^^ WARNING: irrefutable `if let` guard pattern [irrefutable_let_patterns] | ||
| _ => {} | ||
| } | ||
| } | ||
| } | ||
                
      
                  Nadrieril marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| fn main() {} | ||
        
          
          
            37 changes: 37 additions & 0 deletions
          
          37 
        
  tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.stderr
  
  
      
      
   
        
      
      
    
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| error: a never pattern is always unreachable | ||
| --> $DIR/ICE-133063-never-arm-no-otherwise-block.rs:13:46 | ||
| | | ||
| LL | !) if let _ = split_last(&()) => {} | ||
| | ^^ | ||
| | | | ||
| | this will never be executed | ||
| | help: remove this expression | ||
| 
     | 
||
| error: mismatched types | ||
| --> $DIR/ICE-133063-never-arm-no-otherwise-block.rs:12:14 | ||
| | | ||
| LL | (!| | ||
| | ^ a never pattern must be used on an uninhabited type | ||
| | | ||
| = note: the matched value is of type `()` | ||
| 
     | 
||
| error: mismatched types | ||
| --> $DIR/ICE-133063-never-arm-no-otherwise-block.rs:13:13 | ||
| | | ||
| LL | !) if let _ = split_last(&()) => {} | ||
| | ^ a never pattern must be used on an uninhabited type | ||
| | | ||
| = note: the matched value is of type `()` | ||
| 
     | 
||
| warning: irrefutable `if let` guard pattern | ||
| --> $DIR/ICE-133063-never-arm-no-otherwise-block.rs:13:19 | ||
| | | ||
| LL | !) if let _ = split_last(&()) => {} | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| = note: this pattern will always match, so the guard is useless | ||
| = help: consider removing the guard and adding a `let` inside the match arm | ||
| = note: `#[warn(irrefutable_let_patterns)]` on by default | ||
| 
     | 
||
| error: aborting due to 3 previous errors; 1 warning emitted | ||
| 
     | 
        
          
          
            12 changes: 12 additions & 0 deletions
          
          12 
        
  tests/ui/rfcs/rfc-0000-never_patterns/ICE-133117-duplicate-never-arm.rs
  
  
      
      
   
        
      
      
    
  
    
      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
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #![feature(never_patterns)] | ||
| #![allow(incomplete_features)] | ||
| 
     | 
||
| fn main() { | ||
| match () { | ||
| (!| | ||
| //~^ ERROR: mismatched types | ||
| !) if true => {} //~ ERROR a never pattern is always unreachable | ||
| //~^ ERROR: mismatched types | ||
| (!|!) if true => {} //~ ERROR a never pattern is always unreachable | ||
| } | ||
| } | ||
                
      
                  Nadrieril marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
        
          
          
            36 changes: 36 additions & 0 deletions
          
          36 
        
  tests/ui/rfcs/rfc-0000-never_patterns/ICE-133117-duplicate-never-arm.stderr
  
  
      
      
   
        
      
      
    
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| error: a never pattern is always unreachable | ||
| --> $DIR/ICE-133117-duplicate-never-arm.rs:8:23 | ||
| | | ||
| LL | !) if true => {} | ||
| | ^^ | ||
| | | | ||
| | this will never be executed | ||
| | help: remove this expression | ||
| 
     | 
||
| error: a never pattern is always unreachable | ||
| --> $DIR/ICE-133117-duplicate-never-arm.rs:10:26 | ||
| | | ||
| LL | (!|!) if true => {} | ||
| | ^^ | ||
| | | | ||
| | this will never be executed | ||
| | help: remove this expression | ||
| 
     | 
||
| error: mismatched types | ||
| --> $DIR/ICE-133117-duplicate-never-arm.rs:6:10 | ||
| | | ||
| LL | (!| | ||
| | ^ a never pattern must be used on an uninhabited type | ||
| | | ||
| = note: the matched value is of type `()` | ||
| 
     | 
||
| error: mismatched types | ||
| --> $DIR/ICE-133117-duplicate-never-arm.rs:8:9 | ||
| | | ||
| LL | !) if true => {} | ||
| | ^ a never pattern must be used on an uninhabited type | ||
| | | ||
| = note: the matched value is of type `()` | ||
| 
     | 
||
| error: aborting due to 4 previous errors | ||
| 
     | 
      
      Oops, something went wrong.
        
    
  
  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.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.