summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfcs/rfc-2497-if-let-chains
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /tests/ui/rfcs/rfc-2497-if-let-chains
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/rfcs/rfc-2497-if-let-chains')
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs14
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr10
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs5
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr33
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs340
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr1021
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs261
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr1462
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs1
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr30
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs6
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr30
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr36
16 files changed, 1802 insertions, 1453 deletions
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs
index e6dee2a1d..cb3be59be 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs
@@ -3,7 +3,7 @@
fn let_or_guard(x: Result<Option<i32>, ()>) {
match x {
Ok(opt) if let Some(4) = opt || false => {}
- //~^ ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
_ => {}
}
}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr
index 26850998c..4b85fdd50 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr
@@ -1,4 +1,4 @@
-error: `let` expressions are not supported here
+error: expected expression, found `let` statement
--> $DIR/ast-validate-guards.rs:5:20
|
LL | Ok(opt) if let Some(4) = opt || false => {}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs
new file mode 100644
index 000000000..530458064
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs
@@ -0,0 +1,14 @@
+// Regression test for #104172
+
+const N: usize = {
+ struct U;
+ !let y = 42;
+ //~^ ERROR expected expression, found `let` statement
+ 3
+};
+
+struct S {
+ x: [(); N]
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr
new file mode 100644
index 000000000..3eaccde3b
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr
@@ -0,0 +1,10 @@
+error: expected expression, found `let` statement
+ --> $DIR/avoid-invalid-mir.rs:5:6
+ |
+LL | !let y = 42;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs
index e0dded152..2c0571a7b 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs
@@ -1,19 +1,18 @@
+// check-pass
+
fn and_chain() {
let z;
if true && { z = 3; true} && z == 3 {}
- //~^ ERROR E0381
}
fn and_chain_2() {
let z;
true && { z = 3; true} && z == 3;
- //~^ ERROR E0381
}
fn or_chain() {
let z;
if false || { z = 3; false} || z == 3 {}
- //~^ ERROR E0381
}
fn main() {
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr
deleted file mode 100644
index 30d5a6779..000000000
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0381]: used binding `z` is possibly-uninitialized
- --> $DIR/chains-without-let.rs:3:34
- |
-LL | let z;
- | - binding declared here but left uninitialized
-LL | if true && { z = 3; true} && z == 3 {}
- | ----- ^ `z` used here but it is possibly-uninitialized
- | |
- | binding initialized here in some conditions
-
-error[E0381]: used binding `z` is possibly-uninitialized
- --> $DIR/chains-without-let.rs:9:31
- |
-LL | let z;
- | - binding declared here but left uninitialized
-LL | true && { z = 3; true} && z == 3;
- | ----- ^ `z` used here but it is possibly-uninitialized
- | |
- | binding initialized here in some conditions
-
-error[E0381]: used binding `z` is possibly-uninitialized
- --> $DIR/chains-without-let.rs:15:36
- |
-LL | let z;
- | - binding declared here but left uninitialized
-LL | if false || { z = 3; false} || z == 3 {}
- | ----- ^ `z` used here but it is possibly-uninitialized
- | |
- | binding initialized here in some conditions
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs
new file mode 100644
index 000000000..096036bb1
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs
@@ -0,0 +1,340 @@
+// Check that we don't suggest enabling a feature for code that's
+// not accepted even with that feature.
+
+#![allow(irrefutable_let_patterns)]
+
+use std::ops::Range;
+
+fn main() {}
+
+fn _if() {
+ if (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if (((let 0 = 1))) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if (let 0 = 1) && true {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if true && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if (let 0 = 1) && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+
+ if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+}
+
+fn _while() {
+ while (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while (((let 0 = 1))) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while (let 0 = 1) && true {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while true && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while (let 0 = 1) && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+
+ while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+}
+
+fn _macros() {
+ macro_rules! use_expr {
+ ($e:expr) => {
+ if $e {}
+ while $e {}
+ }
+ }
+ use_expr!((let 0 = 1 && 0 == 0));
+ //~^ ERROR expected expression, found `let` statement
+ use_expr!((let 0 = 1));
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn nested_within_if_expr() {
+ if &let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if !let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ if *let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ if -let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ fn _check_try_binds_tighter() -> Result<(), ()> {
+ if let 0 = 0? {}
+ //~^ ERROR the `?` operator can only be applied to values that implement `Try`
+ Ok(())
+ }
+ if (let 0 = 0)? {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if true || let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ if (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ if true && (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ if true || (true && let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ let mut x = true;
+ if x = let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if true..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ if ..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ if (let 0 = 0).. {}
+ //~^ ERROR expected expression, found `let` statement
+
+ // Binds as `(let ... = true)..true &&/|| false`.
+ if let Range { start: _, end: _ } = true..true && false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ if let Range { start: _, end: _ } = true..true || false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: F, end } = F)..(|| true)`.
+ const F: fn() -> bool = || true;
+ if let Range { start: F, end } = F..|| true {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: true, end } = t)..(&&false)`.
+ let t = &&true;
+ if let Range { start: true, end } = t..&&false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ if let true = let true = true {}
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn nested_within_while_expr() {
+ while &let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while !let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ while *let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ while -let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ fn _check_try_binds_tighter() -> Result<(), ()> {
+ while let 0 = 0? {}
+ //~^ ERROR the `?` operator can only be applied to values that implement `Try`
+ Ok(())
+ }
+ while (let 0 = 0)? {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while true || let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ while (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ while true && (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ while true || (true && let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ let mut x = true;
+ while x = let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while true..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ while ..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ while (let 0 = 0).. {}
+ //~^ ERROR expected expression, found `let` statement
+
+ // Binds as `(let ... = true)..true &&/|| false`.
+ while let Range { start: _, end: _ } = true..true && false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ while let Range { start: _, end: _ } = true..true || false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: F, end } = F)..(|| true)`.
+ const F: fn() -> bool = || true;
+ while let Range { start: F, end } = F..|| true {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: true, end } = t)..(&&false)`.
+ let t = &&true;
+ while let Range { start: true, end } = t..&&false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ while let true = let true = true {}
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn not_error_because_clarified_intent() {
+ if let Range { start: _, end: _ } = (true..true || false) { }
+
+ if let Range { start: _, end: _ } = (true..true && false) { }
+
+ while let Range { start: _, end: _ } = (true..true || false) { }
+
+ while let Range { start: _, end: _ } = (true..true && false) { }
+}
+
+fn outside_if_and_while_expr() {
+ &let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+
+ !let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ *let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ -let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ let _ = let _ = 3;
+ //~^ ERROR expected expression, found `let` statement
+
+ fn _check_try_binds_tighter() -> Result<(), ()> {
+ let 0 = 0?;
+ //~^ ERROR the `?` operator can only be applied to values that implement `Try`
+ Ok(())
+ }
+ (let 0 = 0)?;
+ //~^ ERROR expected expression, found `let` statement
+
+ true || let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ (true || let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+ true && (true || let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+
+ let mut x = true;
+ x = let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+
+ true..(let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+ ..(let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+ (let 0 = 0)..;
+ //~^ ERROR expected expression, found `let` statement
+
+ (let Range { start: _, end: _ } = true..true || false);
+ //~^ ERROR mismatched types
+ //~| ERROR expected expression, found `let` statement
+
+ (let true = let true = true);
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+
+ {
+ #[cfg(FALSE)]
+ let x = true && let y = 1;
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ #[cfg(FALSE)]
+ {
+ [1, 2, 3][let _ = ()]
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ // Check function tail position.
+ &let 0 = 0
+ //~^ ERROR expected expression, found `let` statement
+}
+
+// Let's make sure that `let` inside const generic arguments are considered.
+fn inside_const_generic_arguments() {
+ struct A<const B: bool>;
+ impl<const B: bool> A<{B}> { const O: u32 = 5; }
+
+ if let A::<{
+ true && let 1 = 1
+ //~^ ERROR expected expression, found `let` statement
+ }>::O = 5 {}
+
+ while let A::<{
+ true && let 1 = 1
+ //~^ ERROR expected expression, found `let` statement
+ }>::O = 5 {}
+
+ if A::<{
+ true && let 1 = 1
+ //~^ ERROR expected expression, found `let` statement
+ }>::O == 5 {}
+
+ // In the cases above we have `ExprKind::Block` to help us out.
+ // Below however, we would not have a block and so an implementation might go
+ // from visiting expressions to types without banning `let` expressions down the tree.
+ // This tests ensures that we are not caught by surprise should the parser
+ // admit non-IDENT expressions in const generic arguments.
+
+ if A::<
+ true && let 1 = 1
+ //~^ ERROR expressions must be enclosed in braces
+ //~| ERROR expected expression, found `let` statement
+ >::O == 5 {}
+}
+
+fn with_parenthesis() {
+ let opt = Some(Some(1i32));
+
+ if (let Some(a) = opt && true) {
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ if (let Some(a) = opt) && true {
+ //~^ ERROR expected expression, found `let` statement
+ }
+ if (let Some(a) = opt) && (let Some(b) = a) {
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ }
+
+ if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ }
+ if (let Some(a) = opt && (let Some(b) = a)) && true {
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ }
+ if (let Some(a) = opt && (true)) && true {
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ #[cfg(FALSE)]
+ let x = (true && let y = 1);
+ //~^ ERROR expected expression, found `let` statement
+
+ #[cfg(FALSE)]
+ {
+ ([1, 2, 3][let _ = ()])
+ //~^ ERROR expected expression, found `let` statement
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr
new file mode 100644
index 000000000..31f389512
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr
@@ -0,0 +1,1021 @@
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:11:9
+ |
+LL | if (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:11:9
+ |
+LL | if (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:14:11
+ |
+LL | if (((let 0 = 1))) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:14:11
+ |
+LL | if (((let 0 = 1))) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:17:9
+ |
+LL | if (let 0 = 1) && true {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:17:9
+ |
+LL | if (let 0 = 1) && true {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:20:17
+ |
+LL | if true && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:20:17
+ |
+LL | if true && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:9
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:9
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:24
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:24
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:22
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:35
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:34:12
+ |
+LL | while (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:34:12
+ |
+LL | while (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:37:14
+ |
+LL | while (((let 0 = 1))) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:37:14
+ |
+LL | while (((let 0 = 1))) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:40:12
+ |
+LL | while (let 0 = 1) && true {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:40:12
+ |
+LL | while (let 0 = 1) && true {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:43:20
+ |
+LL | while true && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:43:20
+ |
+LL | while true && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:12
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:12
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:27
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:27
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:25
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:38
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:70:9
+ |
+LL | if &let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:73:9
+ |
+LL | if !let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:75:9
+ |
+LL | if *let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:77:9
+ |
+LL | if -let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:85:9
+ |
+LL | if (let 0 = 0)? {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:88:16
+ |
+LL | if true || let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `||` operators are not supported in let chain expressions
+ --> $DIR/disallowed-positions-without-feature-gate.rs:88:13
+ |
+LL | if true || let 0 = 0 {}
+ | ^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:90:17
+ |
+LL | if (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:92:25
+ |
+LL | if true && (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:94:25
+ |
+LL | if true || (true && let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:98:12
+ |
+LL | if x = let 0 = 0 {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:101:15
+ |
+LL | if true..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:104:11
+ |
+LL | if ..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:106:9
+ |
+LL | if (let 0 = 0).. {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:110:8
+ |
+LL | if let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:113:8
+ |
+LL | if let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:119:8
+ |
+LL | if let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:125:8
+ |
+LL | if let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:129:19
+ |
+LL | if let true = let true = true {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:134:12
+ |
+LL | while &let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:137:12
+ |
+LL | while !let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:139:12
+ |
+LL | while *let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:141:12
+ |
+LL | while -let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:149:12
+ |
+LL | while (let 0 = 0)? {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:152:19
+ |
+LL | while true || let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `||` operators are not supported in let chain expressions
+ --> $DIR/disallowed-positions-without-feature-gate.rs:152:16
+ |
+LL | while true || let 0 = 0 {}
+ | ^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:154:20
+ |
+LL | while (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:156:28
+ |
+LL | while true && (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:158:28
+ |
+LL | while true || (true && let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:162:15
+ |
+LL | while x = let 0 = 0 {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:165:18
+ |
+LL | while true..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:168:14
+ |
+LL | while ..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:170:12
+ |
+LL | while (let 0 = 0).. {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:174:11
+ |
+LL | while let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:177:11
+ |
+LL | while let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:183:11
+ |
+LL | while let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:189:11
+ |
+LL | while let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:193:22
+ |
+LL | while let true = let true = true {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:208:6
+ |
+LL | &let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:211:6
+ |
+LL | !let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:213:6
+ |
+LL | *let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:215:6
+ |
+LL | -let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:217:13
+ |
+LL | let _ = let _ = 3;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:225:6
+ |
+LL | (let 0 = 0)?;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:228:13
+ |
+LL | true || let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:230:14
+ |
+LL | (true || let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:232:22
+ |
+LL | true && (true || let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:236:9
+ |
+LL | x = let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:239:12
+ |
+LL | true..(let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:241:8
+ |
+LL | ..(let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:243:6
+ |
+LL | (let 0 = 0)..;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:246:6
+ |
+LL | (let Range { start: _, end: _ } = true..true || false);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:250:6
+ |
+LL | (let true = let true = true);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:250:17
+ |
+LL | (let true = let true = true);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:256:25
+ |
+LL | let x = true && let y = 1;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:262:19
+ |
+LL | [1, 2, 3][let _ = ()]
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:267:6
+ |
+LL | &let 0 = 0
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:277:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:282:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:287:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:298:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expressions must be enclosed in braces to be used as const generic arguments
+ --> $DIR/disallowed-positions-without-feature-gate.rs:298:9
+ |
+LL | true && let 1 = 1
+ | ^^^^^^^^^^^^^^^^^
+ |
+help: enclose the `const` expression in braces
+ |
+LL | { true && let 1 = 1 }
+ | + +
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:307:9
+ |
+LL | if (let Some(a) = opt && true) {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:307:9
+ |
+LL | if (let Some(a) = opt && true) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:311:9
+ |
+LL | if (let Some(a) = opt) && true {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:311:9
+ |
+LL | if (let Some(a) = opt) && true {
+ | ^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:9
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:9
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:32
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:32
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:327:9
+ |
+LL | if (let Some(a) = opt && (true)) && true {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:327:9
+ |
+LL | if (let Some(a) = opt && (true)) && true {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:332:22
+ |
+LL | let x = (true && let y = 1);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:337:20
+ |
+LL | ([1, 2, 3][let _ = ()])
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:63:16
+ |
+LL | use_expr!((let 0 = 1 && 0 == 0));
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:65:16
+ |
+LL | use_expr!((let 0 = 1));
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:101:8
+ |
+LL | if true..(let 0 = 0) {}
+ | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<bool>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:110:12
+ |
+LL | if let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:113:12
+ |
+LL | if let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:119:12
+ |
+LL | if let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
+ | |
+ | expected fn pointer, found `Range<_>`
+ |
+ = note: expected fn pointer `fn() -> bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:125:12
+ |
+LL | if let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/disallowed-positions-without-feature-gate.rs:81:20
+ |
+LL | if let 0 = 0? {}
+ | ^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:165:11
+ |
+LL | while true..(let 0 = 0) {}
+ | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<bool>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:174:15
+ |
+LL | while let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:177:15
+ |
+LL | while let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:183:15
+ |
+LL | while let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
+ | |
+ | expected fn pointer, found `Range<_>`
+ |
+ = note: expected fn pointer `fn() -> bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:189:15
+ |
+LL | while let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/disallowed-positions-without-feature-gate.rs:145:23
+ |
+LL | while let 0 = 0? {}
+ | ^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:246:10
+ |
+LL | (let Range { start: _, end: _ } = true..true || false);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/disallowed-positions-without-feature-gate.rs:221:17
+ |
+LL | let 0 = 0?;
+ | ^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error: aborting due to 105 previous errors
+
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
index 2a9a5472b..4ac3ea53a 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
@@ -27,64 +27,46 @@ fn main() {}
fn _if() {
if (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (((let 0 = 1))) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (let 0 = 1) && true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (let 0 = 1) && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
fn _while() {
while (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (((let 0 = 1))) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (let 0 = 1) && true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (let 0 = 1) && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
@@ -97,32 +79,21 @@ fn _macros() {
}
}
use_expr!((let 0 = 1 && 0 == 0));
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
use_expr!((let 0 = 1));
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
fn nested_within_if_expr() {
if &let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if !let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if *let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR type `bool` cannot be dereferenced
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if -let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR cannot apply unary operator `-` to type `bool`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
fn _check_try_binds_tighter() -> Result<(), ()> {
if let 0 = 0? {}
@@ -130,91 +101,63 @@ fn nested_within_if_expr() {
Ok(())
}
if (let 0 = 0)? {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR the `?` operator can only be applied to values that implement `Try`
- //~| ERROR the `?` operator can only be used in a function that returns `Result`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true || let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true && (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true || (true && let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
let mut x = true;
if x = let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
if ..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (let 0 = 0).. {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
// Binds as `(let ... = true)..true &&/|| false`.
if let Range { start: _, end: _ } = true..true && false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
if let Range { start: _, end: _ } = true..true || false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: F, end } = F)..(|| true)`.
const F: fn() -> bool = || true;
if let Range { start: F, end } = F..|| true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: true, end } = t)..(&&false)`.
let t = &&true;
if let Range { start: true, end } = t..&&false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
if let true = let true = true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
fn nested_within_while_expr() {
while &let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while !let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while *let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR type `bool` cannot be dereferenced
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while -let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR cannot apply unary operator `-` to type `bool`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
fn _check_try_binds_tighter() -> Result<(), ()> {
while let 0 = 0? {}
@@ -222,72 +165,51 @@ fn nested_within_while_expr() {
Ok(())
}
while (let 0 = 0)? {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR the `?` operator can only be applied to values that implement `Try`
- //~| ERROR the `?` operator can only be used in a function that returns `Result`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true || let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true && (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true || (true && let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
let mut x = true;
while x = let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
while ..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (let 0 = 0).. {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
// Binds as `(let ... = true)..true &&/|| false`.
while let Range { start: _, end: _ } = true..true && false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
while let Range { start: _, end: _ } = true..true || false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: F, end } = F)..(|| true)`.
const F: fn() -> bool = || true;
while let Range { start: F, end } = F..|| true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: true, end } = t)..(&&false)`.
let t = &&true;
while let Range { start: true, end } = t..&&false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
while let true = let true = true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
fn not_error_because_clarified_intent() {
@@ -302,20 +224,14 @@ fn not_error_because_clarified_intent() {
fn outside_if_and_while_expr() {
&let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
!let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
*let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR type `bool` cannot be dereferenced
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
-let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR cannot apply unary operator `-` to type `bool`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
fn _check_try_binds_tighter() -> Result<(), ()> {
let 0 = 0?;
@@ -323,44 +239,32 @@ fn outside_if_and_while_expr() {
Ok(())
}
(let 0 = 0)?;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR the `?` operator can only be used in a function that returns `Result`
- //~| ERROR the `?` operator can only be applied to values that implement `Try`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
true || let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
(true || let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
true && (true || let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
let mut x = true;
x = let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
true..(let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
..(let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
(let 0 = 0)..;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
(let Range { start: _, end: _ } = true..true || false);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR mismatched types
//~| ERROR expected expression, found `let` statement
(let true = let true = true);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
{
@@ -377,9 +281,7 @@ fn outside_if_and_while_expr() {
// Check function tail position.
&let 0 = 0
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
// Let's make sure that `let` inside const generic arguments are considered.
@@ -389,20 +291,17 @@ fn inside_const_generic_arguments() {
if let A::<{
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}>::O = 5 {}
while let A::<{
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}>::O = 5 {}
if A::<{
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}>::O == 5 {}
// In the cases above we have `ExprKind::Block` to help us out.
@@ -413,8 +312,7 @@ fn inside_const_generic_arguments() {
if A::<
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expressions must be enclosed in braces
+ //~^ ERROR expressions must be enclosed in braces
//~| ERROR expected expression, found `let` statement
>::O == 5 {}
}
@@ -423,38 +321,29 @@ fn with_parenthesis() {
let opt = Some(Some(1i32));
if (let Some(a) = opt && true) {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
if (let Some(a) = opt) && true {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
if (let Some(a) = opt) && (let Some(b) = a) {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
if let Some(a) = opt && (true && true) {
}
if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
if (let Some(a) = opt && (let Some(b) = a)) && true {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
if (let Some(a) = opt && (true)) && true {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
if (true && (true)) && let Some(a) = opt {
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr
index 81933173c..ab58abf4d 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr
@@ -2,503 +2,6 @@ error: expected expression, found `let` statement
--> $DIR/disallowed-positions.rs:29:9
|
LL | if (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:33:11
- |
-LL | if (((let 0 = 1))) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:37:9
- |
-LL | if (let 0 = 1) && true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:41:17
- |
-LL | if true && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:45:9
- |
-LL | if (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:45:24
- |
-LL | if (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:51:35
- |
-LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:51:48
- |
-LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:51:61
- |
-LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:61:12
- |
-LL | while (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:65:14
- |
-LL | while (((let 0 = 1))) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:69:12
- |
-LL | while (let 0 = 1) && true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:73:20
- |
-LL | while true && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:77:12
- |
-LL | while (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:77:27
- |
-LL | while (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:83:38
- |
-LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:83:51
- |
-LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:83:64
- |
-LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:110:9
- |
-LL | if &let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:115:9
- |
-LL | if !let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:118:9
- |
-LL | if *let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:122:9
- |
-LL | if -let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:132:9
- |
-LL | if (let 0 = 0)? {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:138:16
- |
-LL | if true || let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:141:17
- |
-LL | if (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:144:25
- |
-LL | if true && (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:147:25
- |
-LL | if true || (true && let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:152:12
- |
-LL | if x = let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:157:15
- |
-LL | if true..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:161:11
- |
-LL | if ..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:165:9
- |
-LL | if (let 0 = 0).. {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:196:19
- |
-LL | if let true = let true = true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:202:12
- |
-LL | while &let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:207:12
- |
-LL | while !let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:210:12
- |
-LL | while *let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:214:12
- |
-LL | while -let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:224:12
- |
-LL | while (let 0 = 0)? {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:230:19
- |
-LL | while true || let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:233:20
- |
-LL | while (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:236:28
- |
-LL | while true && (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:239:28
- |
-LL | while true || (true && let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:244:15
- |
-LL | while x = let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:249:18
- |
-LL | while true..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:253:14
- |
-LL | while ..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:257:12
- |
-LL | while (let 0 = 0).. {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:288:22
- |
-LL | while let true = let true = true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:304:6
- |
-LL | &let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:308:6
- |
-LL | !let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:311:6
- |
-LL | *let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:315:6
- |
-LL | -let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:325:6
- |
-LL | (let 0 = 0)?;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:331:13
- |
-LL | true || let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:334:14
- |
-LL | (true || let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:337:22
- |
-LL | true && (true || let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:342:9
- |
-LL | x = let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:346:12
- |
-LL | true..(let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:349:8
- |
-LL | ..(let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:352:6
- |
-LL | (let 0 = 0)..;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:356:6
- |
-LL | (let Range { start: _, end: _ } = true..true || false);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:361:6
- |
-LL | (let true = let true = true);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:361:17
- |
-LL | (let true = let true = true);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:368:25
- |
-LL | let x = true && let y = 1;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:374:19
- |
-LL | [1, 2, 3][let _ = ()]
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:379:6
- |
-LL | &let 0 = 0
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:391:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:397:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:403:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:415:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expressions must be enclosed in braces to be used as const generic arguments
- --> $DIR/disallowed-positions.rs:415:9
- |
-LL | true && let 1 = 1
- | ^^^^^^^^^^^^^^^^^
- |
-help: enclose the `const` expression in braces
- |
-LL | { true && let 1 = 1 }
- | + +
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:425:9
- |
-LL | if (let Some(a) = opt && true) {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:430:9
- |
-LL | if (let Some(a) = opt) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:434:9
- |
-LL | if (let Some(a) = opt) && (let Some(b) = a) {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:434:32
- |
-LL | if (let Some(a) = opt) && (let Some(b) = a) {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:443:9
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:443:31
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:449:9
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:449:31
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:455:9
- |
-LL | if (let Some(a) = opt && (true)) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:472:22
- |
-LL | let x = (true && let y = 1);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:477:20
- |
-LL | ([1, 2, 3][let _ = ()])
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:29:9
- |
-LL | if (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
@@ -508,1012 +11,863 @@ note: `let`s wrapped in parentheses are not supported in a context with let chai
LL | if (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:33:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:32:11
|
LL | if (((let 0 = 1))) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:33:11
+ --> $DIR/disallowed-positions.rs:32:11
|
LL | if (((let 0 = 1))) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:37:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:35:9
|
LL | if (let 0 = 1) && true {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:37:9
+ --> $DIR/disallowed-positions.rs:35:9
|
LL | if (let 0 = 1) && true {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:41:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:38:17
|
LL | if true && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:41:17
+ --> $DIR/disallowed-positions.rs:38:17
|
LL | if true && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:45:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:41:9
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:45:9
+ --> $DIR/disallowed-positions.rs:41:9
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:45:24
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:41:24
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:45:24
+ --> $DIR/disallowed-positions.rs:41:24
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:51:35
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:51:35
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:51:48
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:45:48
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:51:35
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:51:61
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:45:61
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:51:35
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:61:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:52:12
|
LL | while (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:61:12
+ --> $DIR/disallowed-positions.rs:52:12
|
LL | while (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:65:14
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:55:14
|
LL | while (((let 0 = 1))) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:65:14
+ --> $DIR/disallowed-positions.rs:55:14
|
LL | while (((let 0 = 1))) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:69:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:58:12
|
LL | while (let 0 = 1) && true {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:69:12
+ --> $DIR/disallowed-positions.rs:58:12
|
LL | while (let 0 = 1) && true {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:73:20
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:61:20
|
LL | while true && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:73:20
+ --> $DIR/disallowed-positions.rs:61:20
|
LL | while true && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:77:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:64:12
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:77:12
+ --> $DIR/disallowed-positions.rs:64:12
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:77:27
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:64:27
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:77:27
+ --> $DIR/disallowed-positions.rs:64:27
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:83:38
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:83:38
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:83:51
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:68:51
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:83:38
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:83:64
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:68:64
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:83:38
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^^^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^^^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:110:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:88:9
|
LL | if &let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:115:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:91:9
|
LL | if !let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:118:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:93:9
|
LL | if *let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:122:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:95:9
|
LL | if -let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:132:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:103:9
|
LL | if (let 0 = 0)? {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:132:9
- |
-LL | if (let 0 = 0)? {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:138:16
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:106:16
|
LL | if true || let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:138:13
+ --> $DIR/disallowed-positions.rs:106:13
|
LL | if true || let 0 = 0 {}
| ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:141:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:108:17
|
LL | if (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:141:14
- |
-LL | if (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:144:25
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:110:25
|
LL | if true && (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:144:22
- |
-LL | if true && (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:147:25
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:112:25
|
LL | if true || (true && let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:147:17
- |
-LL | if true || (true && let 0 = 0) {}
- | ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:152:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:116:12
|
LL | if x = let 0 = 0 {}
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:157:15
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:119:15
|
LL | if true..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:157:15
- |
-LL | if true..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:161:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:122:11
|
LL | if ..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:161:11
- |
-LL | if ..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:165:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:124:9
|
LL | if (let 0 = 0).. {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:165:9
- |
-LL | if (let 0 = 0).. {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:171:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:128:8
|
LL | if let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:175:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:131:8
|
LL | if let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:182:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:137:8
|
LL | if let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:190:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:143:8
|
LL | if let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:196:19
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:147:19
|
LL | if let true = let true = true {}
- | ^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:202:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:152:12
|
LL | while &let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:207:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:155:12
|
LL | while !let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:210:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:157:12
|
LL | while *let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:214:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:159:12
|
LL | while -let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:224:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:167:12
|
LL | while (let 0 = 0)? {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:224:12
- |
-LL | while (let 0 = 0)? {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:230:19
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:170:19
|
LL | while true || let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:230:16
+ --> $DIR/disallowed-positions.rs:170:16
|
LL | while true || let 0 = 0 {}
| ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:233:20
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:172:20
|
LL | while (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:233:17
- |
-LL | while (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:236:28
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:174:28
|
LL | while true && (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:236:25
- |
-LL | while true && (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:239:28
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:176:28
|
LL | while true || (true && let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:239:20
- |
-LL | while true || (true && let 0 = 0) {}
- | ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:244:15
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:180:15
|
LL | while x = let 0 = 0 {}
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:249:18
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:183:18
|
LL | while true..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:249:18
- |
-LL | while true..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:253:14
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:186:14
|
LL | while ..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:253:14
- |
-LL | while ..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:257:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:188:12
|
LL | while (let 0 = 0).. {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:257:12
- |
-LL | while (let 0 = 0).. {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:263:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:192:11
|
LL | while let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:267:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:195:11
|
LL | while let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:274:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:201:11
|
LL | while let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:282:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:207:11
|
LL | while let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:288:22
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:211:22
|
LL | while let true = let true = true {}
- | ^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:304:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:226:6
|
LL | &let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:308:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:229:6
|
LL | !let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:311:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:231:6
|
LL | *let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:315:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:233:6
|
LL | -let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:325:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:241:6
|
LL | (let 0 = 0)?;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:325:6
- |
-LL | (let 0 = 0)?;
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:331:13
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:244:13
|
LL | true || let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:331:10
- |
-LL | true || let 0 = 0;
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:334:14
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:246:14
|
LL | (true || let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:334:11
- |
-LL | (true || let 0 = 0);
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:337:22
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:248:22
|
LL | true && (true || let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:337:19
- |
-LL | true && (true || let 0 = 0);
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:342:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:252:9
|
LL | x = let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:346:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:255:12
|
LL | true..(let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:346:12
- |
-LL | true..(let 0 = 0);
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:349:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:257:8
|
LL | ..(let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:349:8
- |
-LL | ..(let 0 = 0);
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:352:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:259:6
|
LL | (let 0 = 0)..;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:352:6
- |
-LL | (let 0 = 0)..;
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:356:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:262:6
|
LL | (let Range { start: _, end: _ } = true..true || false);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:361:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:266:6
|
LL | (let true = let true = true);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:361:6
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:266:17
|
LL | (let true = let true = true);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:272:25
+ |
+LL | let x = true && let y = 1;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:278:19
+ |
+LL | [1, 2, 3][let _ = ()]
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:379:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:283:6
|
LL | &let 0 = 0
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:391:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:293:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:397:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:298:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:403:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:303:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:415:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:314:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:425:9
+error: expressions must be enclosed in braces to be used as const generic arguments
+ --> $DIR/disallowed-positions.rs:314:9
+ |
+LL | true && let 1 = 1
+ | ^^^^^^^^^^^^^^^^^
+ |
+help: enclose the `const` expression in braces
+ |
+LL | { true && let 1 = 1 }
+ | + +
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:323:9
|
LL | if (let Some(a) = opt && true) {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:425:9
+ --> $DIR/disallowed-positions.rs:323:9
|
LL | if (let Some(a) = opt && true) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:430:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:327:9
|
LL | if (let Some(a) = opt) && true {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:430:9
+ --> $DIR/disallowed-positions.rs:327:9
|
LL | if (let Some(a) = opt) && true {
| ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:434:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:330:9
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:434:9
+ --> $DIR/disallowed-positions.rs:330:9
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:434:32
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:330:32
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:434:32
+ --> $DIR/disallowed-positions.rs:330:32
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:443:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:337:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:443:9
+ --> $DIR/disallowed-positions.rs:337:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:443:31
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:337:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:443:31
+ --> $DIR/disallowed-positions.rs:337:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:449:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:341:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:449:9
+ --> $DIR/disallowed-positions.rs:341:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:449:31
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:341:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:449:31
+ --> $DIR/disallowed-positions.rs:341:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:455:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:345:9
|
LL | if (let Some(a) = opt && (true)) && true {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:455:9
+ --> $DIR/disallowed-positions.rs:345:9
|
LL | if (let Some(a) = opt && (true)) && true {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:110:8
- |
-LL | if &let 0 = 0 {}
- | ^^^^^^^^^^ expected `bool`, found `&bool`
- |
-help: consider removing the borrow
- |
-LL - if &let 0 = 0 {}
-LL + if let 0 = 0 {}
- |
-
-error[E0614]: type `bool` cannot be dereferenced
- --> $DIR/disallowed-positions.rs:118:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:361:22
|
-LL | if *let 0 = 0 {}
- | ^^^^^^^^^^
-
-error[E0600]: cannot apply unary operator `-` to type `bool`
- --> $DIR/disallowed-positions.rs:122:8
+LL | let x = (true && let y = 1);
+ | ^^^
|
-LL | if -let 0 = 0 {}
- | ^^^^^^^^^^ cannot apply unary operator `-`
+ = note: only supported directly in conditions of `if` and `while` expressions
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:132:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:366:20
|
-LL | if (let 0 = 0)? {}
- | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
+LL | ([1, 2, 3][let _ = ()])
+ | ^^^
|
- = help: the trait `Try` is not implemented for `bool`
+ = note: only supported directly in conditions of `if` and `while` expressions
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/disallowed-positions.rs:132:19
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:81:16
|
-LL | fn nested_within_if_expr() {
- | -------------------------- this function should return `Result` or `Option` to accept `?`
-...
-LL | if (let 0 = 0)? {}
- | ^ cannot use the `?` operator in a function that returns `()`
+LL | use_expr!((let 0 = 1 && 0 == 0));
+ | ^^^
|
- = help: the trait `FromResidual<_>` is not implemented for `()`
+ = note: only supported directly in conditions of `if` and `while` expressions
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:152:8
- |
-LL | if x = let 0 = 0 {}
- | ^^^^^^^^^^^^^ expected `bool`, found `()`
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:83:16
|
-help: you might have meant to compare for equality
+LL | use_expr!((let 0 = 1));
+ | ^^^
|
-LL | if x == let 0 = 0 {}
- | +
+ = note: only supported directly in conditions of `if` and `while` expressions
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:157:8
+ --> $DIR/disallowed-positions.rs:119:8
|
LL | if true..(let 0 = 0) {}
| ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
@@ -1522,25 +876,7 @@ LL | if true..(let 0 = 0) {}
found struct `std::ops::Range<bool>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:161:8
- |
-LL | if ..(let 0 = 0) {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeTo<bool>`
- |
- = note: expected type `bool`
- found struct `RangeTo<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:165:8
- |
-LL | if (let 0 = 0).. {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeFrom<bool>`
- |
- = note: expected type `bool`
- found struct `RangeFrom<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:171:12
+ --> $DIR/disallowed-positions.rs:128:12
|
LL | if let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1551,16 +887,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:171:8
- |
-LL | if let Range { start: _, end: _ } = true..true && false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:175:12
+ --> $DIR/disallowed-positions.rs:131:12
|
LL | if let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1571,16 +898,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:175:8
- |
-LL | if let Range { start: _, end: _ } = true..true || false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:182:12
+ --> $DIR/disallowed-positions.rs:137:12
|
LL | if let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
@@ -1591,29 +909,7 @@ LL | if let Range { start: F, end } = F..|| true {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:182:41
- |
-LL | if let Range { start: F, end } = F..|| true {}
- | ^^^^^^^ expected `bool`, found closure
- |
- = note: expected type `bool`
- found closure `[closure@$DIR/disallowed-positions.rs:182:41: 182:43]`
-help: use parentheses to call this closure
- |
-LL | if let Range { start: F, end } = F..(|| true)() {}
- | + +++
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:182:8
- |
-LL | if let Range { start: F, end } = F..|| true {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:190:12
+ --> $DIR/disallowed-positions.rs:143:12
|
LL | if let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
@@ -1623,29 +919,8 @@ LL | if let Range { start: true, end } = t..&&false {}
= note: expected type `bool`
found struct `std::ops::Range<_>`
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:190:44
- |
-LL | if let Range { start: true, end } = t..&&false {}
- | ^^^^^^^ expected `bool`, found `&&bool`
- |
-help: consider removing the `&&`
- |
-LL - if let Range { start: true, end } = t..&&false {}
-LL + if let Range { start: true, end } = t..false {}
- |
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:190:8
- |
-LL | if let Range { start: true, end } = t..&&false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:128:20
+ --> $DIR/disallowed-positions.rs:99:20
|
LL | if let 0 = 0? {}
| ^^ the `?` operator cannot be applied to type `{integer}`
@@ -1653,61 +928,7 @@ LL | if let 0 = 0? {}
= help: the trait `Try` is not implemented for `{integer}`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:202:11
- |
-LL | while &let 0 = 0 {}
- | ^^^^^^^^^^ expected `bool`, found `&bool`
- |
-help: consider removing the borrow
- |
-LL - while &let 0 = 0 {}
-LL + while let 0 = 0 {}
- |
-
-error[E0614]: type `bool` cannot be dereferenced
- --> $DIR/disallowed-positions.rs:210:11
- |
-LL | while *let 0 = 0 {}
- | ^^^^^^^^^^
-
-error[E0600]: cannot apply unary operator `-` to type `bool`
- --> $DIR/disallowed-positions.rs:214:11
- |
-LL | while -let 0 = 0 {}
- | ^^^^^^^^^^ cannot apply unary operator `-`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:224:11
- |
-LL | while (let 0 = 0)? {}
- | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
- |
- = help: the trait `Try` is not implemented for `bool`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/disallowed-positions.rs:224:22
- |
-LL | fn nested_within_while_expr() {
- | ----------------------------- this function should return `Result` or `Option` to accept `?`
-...
-LL | while (let 0 = 0)? {}
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:244:11
- |
-LL | while x = let 0 = 0 {}
- | ^^^^^^^^^^^^^ expected `bool`, found `()`
- |
-help: you might have meant to compare for equality
- |
-LL | while x == let 0 = 0 {}
- | +
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:249:11
+ --> $DIR/disallowed-positions.rs:183:11
|
LL | while true..(let 0 = 0) {}
| ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
@@ -1716,25 +937,7 @@ LL | while true..(let 0 = 0) {}
found struct `std::ops::Range<bool>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:253:11
- |
-LL | while ..(let 0 = 0) {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeTo<bool>`
- |
- = note: expected type `bool`
- found struct `RangeTo<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:257:11
- |
-LL | while (let 0 = 0).. {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeFrom<bool>`
- |
- = note: expected type `bool`
- found struct `RangeFrom<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:263:15
+ --> $DIR/disallowed-positions.rs:192:15
|
LL | while let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1745,16 +948,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:263:11
- |
-LL | while let Range { start: _, end: _ } = true..true && false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:267:15
+ --> $DIR/disallowed-positions.rs:195:15
|
LL | while let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1765,16 +959,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:267:11
- |
-LL | while let Range { start: _, end: _ } = true..true || false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:274:15
+ --> $DIR/disallowed-positions.rs:201:15
|
LL | while let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
@@ -1785,29 +970,7 @@ LL | while let Range { start: F, end } = F..|| true {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:274:44
- |
-LL | while let Range { start: F, end } = F..|| true {}
- | ^^^^^^^ expected `bool`, found closure
- |
- = note: expected type `bool`
- found closure `[closure@$DIR/disallowed-positions.rs:274:44: 274:46]`
-help: use parentheses to call this closure
- |
-LL | while let Range { start: F, end } = F..(|| true)() {}
- | + +++
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:274:11
- |
-LL | while let Range { start: F, end } = F..|| true {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:282:15
+ --> $DIR/disallowed-positions.rs:207:15
|
LL | while let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
@@ -1817,68 +980,16 @@ LL | while let Range { start: true, end } = t..&&false {}
= note: expected type `bool`
found struct `std::ops::Range<_>`
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:282:47
- |
-LL | while let Range { start: true, end } = t..&&false {}
- | ^^^^^^^ expected `bool`, found `&&bool`
- |
-help: consider removing the `&&`
- |
-LL - while let Range { start: true, end } = t..&&false {}
-LL + while let Range { start: true, end } = t..false {}
- |
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:282:11
- |
-LL | while let Range { start: true, end } = t..&&false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:220:23
+ --> $DIR/disallowed-positions.rs:163:23
|
LL | while let 0 = 0? {}
| ^^ the `?` operator cannot be applied to type `{integer}`
|
= help: the trait `Try` is not implemented for `{integer}`
-error[E0614]: type `bool` cannot be dereferenced
- --> $DIR/disallowed-positions.rs:311:5
- |
-LL | *let 0 = 0;
- | ^^^^^^^^^^
-
-error[E0600]: cannot apply unary operator `-` to type `bool`
- --> $DIR/disallowed-positions.rs:315:5
- |
-LL | -let 0 = 0;
- | ^^^^^^^^^^ cannot apply unary operator `-`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:325:5
- |
-LL | (let 0 = 0)?;
- | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
- |
- = help: the trait `Try` is not implemented for `bool`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/disallowed-positions.rs:325:16
- |
-LL | fn outside_if_and_while_expr() {
- | ------------------------------ this function should return `Result` or `Option` to accept `?`
-...
-LL | (let 0 = 0)?;
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:356:10
+ --> $DIR/disallowed-positions.rs:262:10
|
LL | (let Range { start: _, end: _ } = true..true || false);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1888,24 +999,15 @@ LL | (let Range { start: _, end: _ } = true..true || false);
= note: expected type `bool`
found struct `std::ops::Range<_>`
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:379:5
- |
-LL | fn outside_if_and_while_expr() {
- | - help: try adding a return type: `-> &bool`
-...
-LL | &let 0 = 0
- | ^^^^^^^^^^ expected `()`, found `&bool`
-
error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:321:17
+ --> $DIR/disallowed-positions.rs:237:17
|
LL | let 0 = 0?;
| ^^ the `?` operator cannot be applied to type `{integer}`
|
= help: the trait `Try` is not implemented for `{integer}`
-error: aborting due to 215 previous errors
+error: aborting due to 104 previous errors
-Some errors have detailed explanations: E0277, E0308, E0600, E0614.
+Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs
index 2a6c14435..3c572054e 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs
@@ -14,7 +14,6 @@ fn main() {
};
let Some(n) = opt && let another = n else {
//~^ ERROR a `&&` expression cannot be directly assigned in `let...else`
- //~| ERROR `let` expressions are not supported here
//~| ERROR mismatched types
//~| ERROR mismatched types
//~| ERROR expected expression, found `let` statement
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
index 9bc3e7541..0442f1218 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
@@ -14,6 +14,8 @@ error: expected expression, found `let` statement
|
LL | let Some(n) = opt && let another = n else {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: a `&&` expression cannot be directly assigned in `let...else`
--> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:19
@@ -27,13 +29,13 @@ LL | let Some(n) = (opt && let another = n) else {
| + +
error: this `if` expression is missing a block after the condition
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:24:5
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:23:5
|
LL | if let Some(n) = opt else {
| ^^
|
help: add a block here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:24:25
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:23:25
|
LL | if let Some(n) = opt else {
| ^
@@ -44,31 +46,31 @@ LL + let Some(n) = opt else {
|
error: this `if` expression is missing a block after the condition
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:28:5
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:27:5
|
LL | if let Some(n) = opt && n == 1 else {
| ^^
|
help: add a block here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:28:35
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:27:35
|
LL | if let Some(n) = opt && n == 1 else {
| ^
error: this `if` expression is missing a block after the condition
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:32:5
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:31:5
|
LL | if let Some(n) = opt && let another = n else {
| ^^
|
help: add a block here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:32:44
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:31:44
|
LL | if let Some(n) = opt && let another = n else {
| ^
error: expected `{`, found keyword `else`
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:38:33
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:37:33
|
LL | while let Some(n) = opt else {
| ----- ----------------- ^^^^ expected `{`
@@ -77,7 +79,7 @@ LL | while let Some(n) = opt else {
| while parsing the body of this `while` expression
error: expected `{`, found keyword `else`
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:44:43
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:43:43
|
LL | while let Some(n) = opt && n == 1 else {
| ----- --------------------------- ^^^^ expected `{`
@@ -86,7 +88,7 @@ LL | while let Some(n) = opt && n == 1 else {
| while parsing the body of this `while` expression
error: expected `{`, found keyword `else`
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:50:52
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:49:52
|
LL | while let Some(n) = opt && let another = n else {
| ----- ------------------------------------ ^^^^ expected `{`
@@ -94,14 +96,6 @@ LL | while let Some(n) = opt && let another = n else {
| | this `while` condition successfully parsed
| while parsing the body of this `while` expression
-error: `let` expressions are not supported here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:26
- |
-LL | let Some(n) = opt && let another = n else {
- | ^^^^^^^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-
error[E0308]: mismatched types
--> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:19
|
@@ -142,6 +136,6 @@ LL | let Some(n) = opt && let another = n else {
= note: expected type `bool`
found enum `Option<_>`
-error: aborting due to 14 previous errors
+error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
index 2b407ef51..bca7564ef 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
@@ -43,8 +43,7 @@ fn _macros() {
macro_rules! noop_expr { ($e:expr) => {}; }
noop_expr!((let 0 = 1));
- //~^ ERROR `let` expressions in this position are unstable [E0658]
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
macro_rules! use_expr {
($e:expr) => {
@@ -53,8 +52,7 @@ fn _macros() {
}
}
#[cfg(FALSE)] (let 0 = 1);
- //~^ ERROR `let` expressions in this position are unstable [E0658]
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
use_expr!(let 0 = 1);
//~^ ERROR no rules expected the token `let`
}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
index 7a43b71fc..6f7473675 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
@@ -1,17 +1,21 @@
error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:55:20
+ --> $DIR/feature-gate.rs:54:20
|
LL | #[cfg(FALSE)] (let 0 = 1);
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:45:17
|
LL | noop_expr!((let 0 = 1));
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: no rules expected the token `let`
- --> $DIR/feature-gate.rs:58:15
+ --> $DIR/feature-gate.rs:56:15
|
LL | macro_rules! use_expr {
| --------------------- when calling this macro
@@ -20,7 +24,7 @@ LL | use_expr!(let 0 = 1);
| ^^^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$e:expr`
- --> $DIR/feature-gate.rs:50:10
+ --> $DIR/feature-gate.rs:49:10
|
LL | ($e:expr) => {
| ^^^^^^^
@@ -97,24 +101,6 @@ LL | while let Range { start: _, end: _ } = (true..true) && false {}
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:55:20
- |
-LL | #[cfg(FALSE)] (let 0 = 1);
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:45:17
- |
-LL | noop_expr!((let 0 = 1));
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error: aborting due to 13 previous errors
+error: aborting due to 11 previous errors
For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
index a942d1f4c..dce1c19ff 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
@@ -13,6 +13,7 @@ fn main() {
if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
//~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
true
}
}
@@ -31,6 +32,7 @@ fn main() {
{
if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
//~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
true
}
}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr
index d1ce83c72..247fad2e9 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr
@@ -3,36 +3,64 @@ error: expected expression, found `let` statement
|
LL | let _ = &&let Some(x) = Some(42);
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:13:47
|
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:13:57
|
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:13:12
+ |
+LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
- --> $DIR/invalid-let-in-a-valid-let-context.rs:23:23
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:24:23
|
LL | [1, 2, 3][let _ = ()];
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
- --> $DIR/invalid-let-in-a-valid-let-context.rs:32:47
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:33:47
|
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:33:12
+ |
+LL | if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
- --> $DIR/invalid-let-in-a-valid-let-context.rs:40:21
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:42:21
|
LL | let x = let y = 1;
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
-error: aborting due to 6 previous errors
+error: aborting due to 8 previous errors