rename irrefutable_let_pattern
to irrefutable_let_patterns
This commit is contained in:
parent
e7c7f5f071
commit
92d4ae2be2
@ -1,4 +1,4 @@
|
||||
# `irrefutable_let_pattern`
|
||||
# `irrefutable_let_patterns`
|
||||
|
||||
The tracking issue for this feature is: [#44495]
|
||||
|
||||
@ -11,13 +11,13 @@ in the `if let` and `while let` forms. The old way was to always error
|
||||
but now with a tag the error-by-default lint can be switched off.
|
||||
|
||||
```rust
|
||||
#![feature(irrefutable_let_pattern)]
|
||||
#![feature(irrefutable_let_patterns)]
|
||||
|
||||
fn main() {
|
||||
#[allow(irrefutable_let_pattern)]
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
if let _ = 5 {}
|
||||
|
||||
#[allow(irrefutable_let_pattern)]
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
while let _ = 5 {}
|
||||
}
|
||||
```
|
@ -369,7 +369,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
|
||||
NotUseful => {
|
||||
match source {
|
||||
hir::MatchSource::IfLetDesugar { .. } => {
|
||||
if cx.tcx.features().irrefutable_let_pattern {
|
||||
if cx.tcx.features().irrefutable_let_patterns {
|
||||
cx.tcx.lint_node(
|
||||
lint::builtin::IRREFUTABLE_LET_PATTERNS,
|
||||
hir_pat.id, pat.span,
|
||||
@ -404,7 +404,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
|
||||
},
|
||||
// The arm with the wildcard pattern.
|
||||
1 => {
|
||||
if cx.tcx.features().irrefutable_let_pattern {
|
||||
if cx.tcx.features().irrefutable_let_patterns {
|
||||
cx.tcx.lint_node(
|
||||
lint::builtin::IRREFUTABLE_LET_PATTERNS,
|
||||
hir_pat.id, pat.span,
|
||||
|
@ -468,7 +468,7 @@ declare_features! (
|
||||
(active, tool_attributes, "1.25.0", Some(44690), None),
|
||||
|
||||
// allow irrefutable patterns in if-let and while-let statements (RFC 2086)
|
||||
(active, irrefutable_let_pattern, "1.27.0", Some(44495), None),
|
||||
(active, irrefutable_let_patterns, "1.27.0", Some(44495), None),
|
||||
|
||||
// Allows use of the :literal macro fragment specifier (RFC 1576)
|
||||
(active, macro_literal_matcher, "1.27.0", Some(35625), None),
|
||||
|
@ -1,4 +1,4 @@
|
||||
// gate-test-irrefutable_let_pattern
|
||||
// gate-test-irrefutable_let_patterns
|
||||
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
@ -11,7 +11,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
#[allow(irrefutable_let_pattern)]
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
if let _ = 5 {}
|
||||
//~^ ERROR 15:12: 15:13: irrefutable if-let pattern [E0162]
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// should-fail-irrefutable_let_pattern
|
||||
// should-fail-irrefutable_let_patterns
|
||||
fn main() {
|
||||
if let _ = 5 {}
|
||||
//~^ ERROR irrefutable if-let pattern [E0162]
|
||||
|
@ -8,10 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(irrefutable_let_pattern)]
|
||||
#![feature(irrefutable_let_patterns)]
|
||||
|
||||
// should-fail-irrefutable_let_pattern_with_gate
|
||||
// should-fail-irrefutable_let_patterns_with_gate
|
||||
fn main() {
|
||||
if let _ = 5 {}
|
||||
//~^ ERROR irrefutable if-let pattern [irrefutable_let_pattern]
|
||||
//~^ ERROR irrefutable if-let pattern [irrefutable_let_patterns]
|
||||
}
|
||||
|
@ -8,14 +8,14 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(irrefutable_let_pattern)]
|
||||
#![feature(irrefutable_let_patterns)]
|
||||
|
||||
// must-compile-successfully-irrefutable_let_pattern_with_gate
|
||||
// must-compile-successfully-irrefutable_let_patterns_with_gate
|
||||
fn main() {
|
||||
#[allow(irrefutable_let_pattern)]
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
if let _ = 5 {}
|
||||
|
||||
#[allow(irrefutable_let_pattern)]
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
while let _ = 5 {
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user