diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 474ec2b589b..e13e9bdf96b 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -639,7 +639,11 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) { }; } gate_all!(if_let_guard, "`if let` guards are experimental"); - gate_all!(let_chains, "`let` expressions in this position are experimental"); + gate_all!( + let_chains, + "`let` expressions in this position are experimental", + "you can write `matches!(, )` instead of `let = `" + ); gate_all!( async_closure, "async closures are unstable", diff --git a/src/test/ui/rfc-2294-if-let-guard/feature-gate.stderr b/src/test/ui/rfc-2294-if-let-guard/feature-gate.stderr index 24443a0be84..2b71026dc4b 100644 --- a/src/test/ui/rfc-2294-if-let-guard/feature-gate.stderr +++ b/src/test/ui/rfc-2294-if-let-guard/feature-gate.stderr @@ -33,6 +33,7 @@ LL | () if (let 0 = 1) => {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:14:18 @@ -42,6 +43,7 @@ LL | () if (((let 0 = 1))) => {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:18:23 @@ -51,6 +53,7 @@ LL | () if true && let 0 = 1 => {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:22:15 @@ -60,6 +63,7 @@ LL | () if let 0 = 1 && true => {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:26:16 @@ -69,6 +73,7 @@ LL | () if (let 0 = 1) && true => {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:30:24 @@ -78,6 +83,7 @@ LL | () if true && (let 0 = 1) => {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:34:16 @@ -87,6 +93,7 @@ LL | () if (let 0 = 1) && (let 0 = 1) => {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:34:31 @@ -96,6 +103,7 @@ LL | () if (let 0 = 1) && (let 0 = 1) => {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:40:15 @@ -105,6 +113,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:40:28 @@ -114,6 +123,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:40:42 @@ -123,6 +133,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:40:55 @@ -132,6 +143,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:40:68 @@ -141,6 +153,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:52:15 @@ -150,6 +163,7 @@ LL | () if let Range { start: _, end: _ } = (true..true) && false => {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:68:16 @@ -159,6 +173,7 @@ LL | use_expr!((let 0 = 1 && 0 == 0)); | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:71:16 @@ -168,6 +183,7 @@ LL | use_expr!((let 0 = 1)); | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error: `let` expressions are not supported here --> $DIR/feature-gate.rs:10:16 diff --git a/src/test/ui/rfc-2497-if-let-chains/feature-gate.stderr b/src/test/ui/rfc-2497-if-let-chains/feature-gate.stderr index 67f20462381..96131b38db9 100644 --- a/src/test/ui/rfc-2497-if-let-chains/feature-gate.stderr +++ b/src/test/ui/rfc-2497-if-let-chains/feature-gate.stderr @@ -15,6 +15,7 @@ LL | if (let 0 = 1) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:18:11 @@ -24,6 +25,7 @@ LL | if (((let 0 = 1))) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:22:16 @@ -33,6 +35,7 @@ LL | if true && let 0 = 1 {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:26:8 @@ -42,6 +45,7 @@ LL | if let 0 = 1 && true {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:30:9 @@ -51,6 +55,7 @@ LL | if (let 0 = 1) && true {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:34:17 @@ -60,6 +65,7 @@ LL | if true && (let 0 = 1) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:38:9 @@ -69,6 +75,7 @@ LL | if (let 0 = 1) && (let 0 = 1) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:38:24 @@ -78,6 +85,7 @@ LL | if (let 0 = 1) && (let 0 = 1) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:44:8 @@ -87,6 +95,7 @@ LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:44:21 @@ -96,6 +105,7 @@ LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:44:35 @@ -105,6 +115,7 @@ LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:44:48 @@ -114,6 +125,7 @@ LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:44:61 @@ -123,6 +135,7 @@ LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:56:8 @@ -132,6 +145,7 @@ LL | if let Range { start: _, end: _ } = (true..true) && false {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:64:12 @@ -141,6 +155,7 @@ LL | while (let 0 = 1) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:68:14 @@ -150,6 +165,7 @@ LL | while (((let 0 = 1))) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:72:19 @@ -159,6 +175,7 @@ LL | while true && let 0 = 1 {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:76:11 @@ -168,6 +185,7 @@ LL | while let 0 = 1 && true {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:80:12 @@ -177,6 +195,7 @@ LL | while (let 0 = 1) && true {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:84:20 @@ -186,6 +205,7 @@ LL | while true && (let 0 = 1) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:88:12 @@ -195,6 +215,7 @@ LL | while (let 0 = 1) && (let 0 = 1) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:88:27 @@ -204,6 +225,7 @@ LL | while (let 0 = 1) && (let 0 = 1) {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:94:11 @@ -213,6 +235,7 @@ LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) { | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:94:24 @@ -222,6 +245,7 @@ LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) { | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:94:38 @@ -231,6 +255,7 @@ LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) { | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:94:51 @@ -240,6 +265,7 @@ LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) { | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:94:64 @@ -249,6 +275,7 @@ LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) { | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:106:11 @@ -258,6 +285,7 @@ LL | while let Range { start: _, end: _ } = (true..true) && false {} | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:131:20 @@ -267,6 +295,7 @@ LL | #[cfg(FALSE)] (let 0 = 1); | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:114:17 @@ -276,6 +305,7 @@ LL | noop_expr!((let 0 = 1)); | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:123:16 @@ -285,6 +315,7 @@ LL | use_expr!((let 0 = 1 && 0 == 0)); | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error[E0658]: `let` expressions in this position are experimental --> $DIR/feature-gate.rs:127:16 @@ -294,6 +325,7 @@ LL | use_expr!((let 0 = 1)); | = note: see issue #53667 for more information = help: add `#![feature(let_chains)]` to the crate attributes to enable + = help: you can write `matches!(, )` instead of `let = ` error: invalid parentheses around `let` expression in `if let` --> $DIR/feature-gate.rs:14:8