-   Notifications  You must be signed in to change notification settings 
- Fork 13.9k
Stabilize allow irrefutable if-let patterns #55639
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
   Closed  
     Closed  
 Changes from all commits
 Commits 
  Show all changes 
  11 commits   Select commit Hold shift + click to select a range 
 a4b8366  Stabalize allow_irrefutable_patterns 
  Nokel81 1e371f8  added and updated tests 
  Nokel81 751e13d  add stderr 
  Nokel81 6783165  Merge branch 'master' into stabalize_allow_irrefutable 
  Nokel81 f78ae35  Merge branch 'master' of github.com:rust-lang/rust into stabalize_all… 
  Nokel81 12492a9  fixed diagnostic text 
  Nokel81 95f56e5  Fixed the inline code 
  Nokel81 3e6940a  Removed erronious feaure_gate to `macro_literal_matcher` 
  Nokel81 b67d0f5  Removed line from test 
  Nokel81 0fe8993  Removed unnecessary stderr file 
  Nokel81 bb87044  Merge branch 'master' into stabalize_allow_irrefutable 
  Nokel81 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
   28 changes: 0 additions & 28 deletions  28   src/doc/unstable-book/src/language-features/irrefutable-let-patterns.md          
  This file was deleted.
  Oops, something went wrong.  
    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 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 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 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 | ||||
|---|---|---|---|---|---|---|
|  | @@ -428,9 +428,6 @@ declare_features! ( | |||||
| // `#[doc(alias = "...")]` | ||||||
| (active, doc_alias, "1.27.0", Some(50146), None), | ||||||
|  | ||||||
| // Allows irrefutable patterns in `if let` and `while let` statements (RFC 2086). | ||||||
| (active, irrefutable_let_patterns, "1.27.0", Some(44495), None), | ||||||
|  | ||||||
| // inconsistent bounds in where clauses | ||||||
| (active, trivial_bounds, "1.28.0", Some(48214), None), | ||||||
|  | ||||||
|  | @@ -686,6 +683,9 @@ declare_features! ( | |||||
| (accepted, extern_crate_item_prelude, "1.31.0", Some(55599), None), | ||||||
| // Allows use of the `:literal` macro fragment specifier (RFC 1576). | ||||||
| (accepted, macro_literal_matcher, "1.31.0", Some(35625), None), | ||||||
| // Allows irrefutable patterns in if-let and while-let statements (RFC 2086) | ||||||
| (accepted, irrefutable_let_patterns, "1.32.0", Some(44495), None), | ||||||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.  Suggested change  
 It slipped so you'll have to bump the version. | ||||||
| // Use `?` as the Kleene "at most one" operator | ||||||
| // Integer match exhaustiveness checking (RFC 2591) | ||||||
| (accepted, exhaustive_integer_patterns, "1.32.0", Some(50907), None), | ||||||
| // Use `?` as the Kleene "at most one" operator. | ||||||
|  | ||||||
   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 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   
        8 changes: 8 additions & 0 deletions  8   src/test/run-pass/binding/allow_irrefutable_let_patterns.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,8 @@ | ||
| warning: the feature `irrefutable_let_patterns` has been stable since 1.32.0 and no longer requires an attribute to enable | ||
|   Centril marked this conversation as resolved. Outdated   Show resolved Hide resolved | ||
|  | ||
| --> $DIR/allow_irrefutable_let_patterns.rs:12:12 | ||
| | | ||
| LL | #![feature(irrefutable_let_patterns)] | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| = note: #[warn(stable_features)] on by default | ||
This file was deleted.
  Oops, something went wrong.  
 This file was deleted.
  Oops, something went wrong.  
 This file was deleted.
  Oops, something went wrong.  
    9 changes: 0 additions & 9 deletions  9   src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.stderr          
  This file was deleted.
  Oops, something went wrong.  
    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 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 | 
|---|---|---|
| @@ -1,39 +1,62 @@ | ||
| error[E0162]: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:23:10 | ||
| warning: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:16:13 | ||
| | | ||
| LL | foo!(a, 1, { //~ ERROR irrefutable if-let | ||
| | ^ irrefutable pattern | ||
|  | ||
| error[E0162]: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:26:10 | ||
| LL | if let $p = $e $b | ||
| | ^^ | ||
| ... | ||
| LL | / foo!(a, 1, { //~ warning irrefutable if-let | ||
| LL | | println!("irrefutable pattern"); | ||
| LL | | }); | ||
| | |_______- in this macro invocation | ||
| | | ||
| LL | bar!(a, 1, { //~ ERROR irrefutable if-let | ||
| | ^ irrefutable pattern | ||
| = note: #[warn(irrefutable_let_patterns)] on by default | ||
|  | ||
| error[E0162]: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:32:12 | ||
| warning: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:16:13 | ||
| | | ||
| LL | if let a = 1 { //~ ERROR irrefutable if-let | ||
| | ^ irrefutable pattern | ||
| LL | if let $p = $e $b | ||
| | ^^ | ||
| ... | ||
| LL | / bar!(a, 1, { //~ warning irrefutable if-let | ||
| LL | | println!("irrefutable pattern"); | ||
| LL | | }); | ||
| | |_______- in this macro invocation | ||
|  | ||
| error[E0162]: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:36:12 | ||
| warning: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:34:5 | ||
| | | ||
| LL | if let a = 1 { //~ ERROR irrefutable if-let | ||
| | ^ irrefutable pattern | ||
| LL | / if let a = 1 { //~ warning irrefutable if-let | ||
| LL | | println!("irrefutable pattern"); | ||
| LL | | } | ||
| | |_____^ | ||
|  | ||
| error[E0162]: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:46:19 | ||
| warning: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:38:5 | ||
| | | ||
| LL | } else if let a = 1 { //~ ERROR irrefutable if-let | ||
| | ^ irrefutable pattern | ||
| LL | / if let a = 1 { //~ warning irrefutable if-let | ||
| LL | | println!("irrefutable pattern"); | ||
| LL | | } else if true { | ||
| LL | | println!("else-if in irrefutable if-let"); | ||
| LL | | } else { | ||
| LL | | println!("else in irrefutable if-let"); | ||
| LL | | } | ||
| | |_____^ | ||
|  | ||
| error[E0162]: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:52:19 | ||
| warning: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:48:12 | ||
| | | ||
| LL | } else if let a = 1 { //~ ERROR irrefutable if-let | ||
| | ^ irrefutable pattern | ||
| LL | } else if let a = 1 { //~ warning irrefutable if-let | ||
| | ____________^ | ||
| LL | | println!("irrefutable pattern"); | ||
| LL | | } | ||
| | |_____^ | ||
|  | ||
| error: aborting due to 6 previous errors | ||
| warning: irrefutable if-let pattern | ||
| --> $DIR/if-let.rs:54:12 | ||
| | | ||
| LL | } else if let a = 1 { //~ warning irrefutable if-let | ||
| | ____________^ | ||
| LL | | println!("irrefutable pattern"); | ||
| LL | | } | ||
| | |_____^ | ||
|  | ||
| For more information about this error, try `rustc --explain E0162`. | 
   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   
       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.