summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfcs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfcs')
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr5
-rw-r--r--tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs2
-rw-r--r--tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs26
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs18
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr35
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs36
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr285
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs15
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs16
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs14
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs14
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs16
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs97
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr67
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs41
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs25
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr54
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs18
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs23
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs16
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs2
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs6
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.rs (renamed from tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.rs)0
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.stderr (renamed from tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.stderr)2
-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
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs3
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr49
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs16
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr2
60 files changed, 2489 insertions, 1797 deletions
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr
index 872cb9b8b..4e7f3098a 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr
@@ -28,7 +28,8 @@ note: `NonExhaustiveEnum` defined here
|
LL | pub enum NonExhaustiveEnum {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive
+ = note: the matched value is of type `NonExhaustiveEnum`
+ = note: `NonExhaustiveEnum` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ NonExhaustiveEnum::Struct { .. } => "third",
@@ -46,7 +47,7 @@ note: `NonExhaustiveEnum` defined here
|
LL | pub enum NonExhaustiveEnum {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive
+ = note: the matched value is of type `NonExhaustiveEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ match enum_unit {
diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs
index 0cab47170..f0e111b57 100644
--- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs
+++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs
@@ -1,7 +1,7 @@
#![feature(start)]
#[start]
-#[track_caller] //~ ERROR `start` is not allowed to be `#[track_caller]`
+#[track_caller] //~ ERROR `#[start]` function is not allowed to be `#[track_caller]`
fn start(_argc: isize, _argv: *const *const u8) -> isize {
panic!("{}: oh no", std::panic::Location::caller());
}
diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr
index 454c98ff9..b6ef62152 100644
--- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr
+++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr
@@ -1,10 +1,10 @@
-error: `start` is not allowed to be `#[track_caller]`
+error: `#[start]` function is not allowed to be `#[track_caller]`
--> $DIR/error-with-start.rs:4:1
|
LL | #[track_caller]
| ^^^^^^^^^^^^^^^
LL | fn start(_argc: isize, _argv: *const *const u8) -> isize {
- | -------------------------------------------------------- `start` is not allowed to be `#[track_caller]`
+ | -------------------------------------------------------- `#[start]` function is not allowed to be `#[track_caller]`
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs
new file mode 100644
index 000000000..5c42c0d8b
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs
@@ -0,0 +1,26 @@
+// Ensure if let guards can be used in constant expressions.
+// build-pass
+
+#![feature(if_let_guard)]
+
+const fn match_if_let(x: Option<i32>, y: Option<i32>) -> i32 {
+ match x {
+ None if let Some(a @ 5) = y => a,
+ Some(z) if let (Some(_), 12) = (y, z) => 2,
+ _ => 3,
+ }
+}
+
+const ASSERTS: usize = {
+ assert!(match_if_let(None, Some(5)) == 5);
+ assert!(match_if_let(Some(12), Some(3)) == 2);
+ assert!(match_if_let(None, Some(4)) == 3);
+ assert!(match_if_let(Some(11), Some(3)) == 3);
+ assert!(match_if_let(Some(12), None) == 3);
+ assert!(match_if_let(None, None) == 3);
+ 0
+};
+
+fn main() {
+ let _: [(); ASSERTS];
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs
new file mode 100644
index 000000000..b4eb54139
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs
@@ -0,0 +1,18 @@
+#![feature(if_let_guard)]
+#![allow(irrefutable_let_patterns)]
+
+fn match_option(x: Option<u32>) {
+ match x {
+ //~^ ERROR non-exhaustive patterns: `None` not covered
+ Some(_) => {}
+ None if let y = x => {}
+ }
+}
+
+fn main() {
+ let x = ();
+ match x {
+ //~^ ERROR non-exhaustive patterns: `()` not covered
+ y if let z = y => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr
new file mode 100644
index 000000000..ddd08854f
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr
@@ -0,0 +1,35 @@
+error[E0004]: non-exhaustive patterns: `None` not covered
+ --> $DIR/exhaustive.rs:5:11
+ |
+LL | match x {
+ | ^ pattern `None` not covered
+ |
+note: `Option<u32>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<u32>`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ None if let y = x => {},
+LL + None => todo!()
+ |
+
+error[E0004]: non-exhaustive patterns: `()` not covered
+ --> $DIR/exhaustive.rs:14:11
+ |
+LL | match x {
+ | ^ pattern `()` not covered
+ |
+ = note: the matched value is of type `()`
+ = note: match arms with guards don't count towards exhaustivity
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ y if let z = y => {},
+LL + () => todo!()
+ |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
index 3beb20f0a..b8c0eb3e6 100644
--- a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
@@ -8,14 +8,10 @@ fn _if_let_guard() {
//~^ ERROR `if let` guards are experimental
() if (let 0 = 1) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if (((let 0 = 1))) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if true && let 0 = 1 => {}
//~^ ERROR `if let` guards are experimental
@@ -26,36 +22,22 @@ fn _if_let_guard() {
//~| ERROR `let` expressions in this position are unstable
() if (let 0 = 1) && true => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if true && (let 0 = 1) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if (let 0 = 1) && (let 0 = 1) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
() if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
//~^ ERROR `if let` guards are experimental
//~| ERROR `let` expressions in this position are unstable
//~| ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
() if let Range { start: _, end: _ } = (true..true) && false => {}
@@ -76,13 +58,9 @@ fn _macros() {
}
}
use_expr!((let 0 = 1 && 0 == 0));
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
use_expr!((let 0 = 1));
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
match () {
#[cfg(FALSE)]
() if let 0 = 1 => {}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr
index dc182ce46..62534b555 100644
--- a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr
@@ -2,87 +2,6 @@ error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:10:16
|
LL | () if (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:15:18
- |
-LL | () if (((let 0 = 1))) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:28:16
- |
-LL | () if (let 0 = 1) && true => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:33:24
- |
-LL | () if true && (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:38:16
- |
-LL | () if (let 0 = 1) && (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:38:31
- |
-LL | () if (let 0 = 1) && (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:46:42
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:46:55
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:46:68
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:78:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:82:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^
-
-error: no rules expected the token `let`
- --> $DIR/feature-gate.rs:92:15
- |
-LL | macro_rules! use_expr {
- | --------------------- when calling this macro
-...
-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:71:10
- |
-LL | ($e:expr) => {
- | ^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:10:16
- |
-LL | () if (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
@@ -92,135 +11,140 @@ 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/feature-gate.rs:15:18
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:13:18
|
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/feature-gate.rs:15:18
+ --> $DIR/feature-gate.rs:13:18
|
LL | () if (((let 0 = 1))) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:28:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:24:16
|
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/feature-gate.rs:28:16
+ --> $DIR/feature-gate.rs:24:16
|
LL | () if (let 0 = 1) && true => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:33:24
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:27:24
|
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/feature-gate.rs:33:24
+ --> $DIR/feature-gate.rs:27:24
|
LL | () if true && (let 0 = 1) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:38:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:30:16
|
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/feature-gate.rs:38:16
+ --> $DIR/feature-gate.rs:30:16
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:38:31
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:30:31
|
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/feature-gate.rs:38:31
+ --> $DIR/feature-gate.rs:30:31
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:46:42
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:34:42
|
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/feature-gate.rs:46:42
+ --> $DIR/feature-gate.rs:34:42
|
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/feature-gate.rs:46:55
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:34:55
|
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/feature-gate.rs:46:42
+ --> $DIR/feature-gate.rs:34:42
|
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/feature-gate.rs:46:68
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:34:68
|
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/feature-gate.rs:46:42
+ --> $DIR/feature-gate.rs:34:42
|
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/feature-gate.rs:78:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:60: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/feature-gate.rs:78:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:82:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:62: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/feature-gate.rs:82:16
+
+error: no rules expected the token `let`
+ --> $DIR/feature-gate.rs:70:15
|
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
+LL | macro_rules! use_expr {
+ | --------------------- when calling this macro
+...
+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:53:10
+ |
+LL | ($e:expr) => {
+ | ^^^^^^^
error[E0658]: `if let` guards are experimental
--> $DIR/feature-gate.rs:7:12
@@ -233,7 +157,7 @@ LL | () if let 0 = 1 => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:20:12
+ --> $DIR/feature-gate.rs:16:12
|
LL | () if true && let 0 = 1 => {}
| ^^^^^^^^^^^^^^^^^^^^
@@ -243,7 +167,7 @@ LL | () if true && let 0 = 1 => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:24:12
+ --> $DIR/feature-gate.rs:20:12
|
LL | () if let 0 = 1 && true => {}
| ^^^^^^^^^^^^^^^^^^^^
@@ -253,7 +177,7 @@ LL | () if let 0 = 1 && true => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:46:12
+ --> $DIR/feature-gate.rs:34:12
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -263,7 +187,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 =
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:61:12
+ --> $DIR/feature-gate.rs:43:12
|
LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -273,7 +197,7 @@ LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:88:12
+ --> $DIR/feature-gate.rs:66:12
|
LL | () if let 0 = 1 => {}
| ^^^^^^^^^^^^
@@ -283,25 +207,7 @@ LL | () if let 0 = 1 => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:10:16
- |
-LL | () if (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:15:18
- |
-LL | () if (((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:20:23
+ --> $DIR/feature-gate.rs:16:23
|
LL | () if true && let 0 = 1 => {}
| ^^^^^^^^^
@@ -310,7 +216,7 @@ LL | () if true && let 0 = 1 => {}
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:24:15
+ --> $DIR/feature-gate.rs:20:15
|
LL | () if let 0 = 1 && true => {}
| ^^^^^^^^^
@@ -319,43 +225,7 @@ LL | () if let 0 = 1 && true => {}
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:28:16
- |
-LL | () if (let 0 = 1) && true => {}
- | ^^^^^^^^^
- |
- = 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:33:24
- |
-LL | () if true && (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:38:16
- |
-LL | () if (let 0 = 1) && (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:38:31
- |
-LL | () if (let 0 = 1) && (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:46:15
+ --> $DIR/feature-gate.rs:34:15
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
@@ -364,7 +234,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 =
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:28
+ --> $DIR/feature-gate.rs:34:28
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
@@ -373,34 +243,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 =
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:42
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^^^^^^^
- |
- = 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:46:55
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^^^^^^^
- |
- = 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:46:68
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^^^^^^^
- |
- = 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:61:15
+ --> $DIR/feature-gate.rs:43:15
|
LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -408,24 +251,6 @@ LL | () if 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:78:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^
- |
- = 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:82:16
- |
-LL | use_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 45 previous errors
+error: aborting due to 23 previous errors
For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs
new file mode 100644
index 000000000..792225e65
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs
@@ -0,0 +1,15 @@
+// References to by-move bindings in an if-let guard *cannot* be used after the guard.
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let x: Option<Option<String>> = Some(Some(String::new()));
+ match x {
+ Some(mut y) if let Some(ref z) = y => {
+ //~^ ERROR: cannot move out of `x.0` because it is borrowed
+ let _z: &String = z;
+ let _y: Option<String> = y;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr
new file mode 100644
index 000000000..b8e1bb324
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr
@@ -0,0 +1,15 @@
+error[E0505]: cannot move out of `x.0` because it is borrowed
+ --> $DIR/guard-lifetime-1.rs:8:14
+ |
+LL | Some(mut y) if let Some(ref z) = y => {
+ | ^^^^^
+ | |
+ | move out of `x.0` occurs here
+ | borrow of `x.0` occurs here
+LL |
+LL | let _z: &String = z;
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs
new file mode 100644
index 000000000..aa2154e3e
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs
@@ -0,0 +1,16 @@
+// References to by-mutable-ref bindings in an if-let guard *can* be used after the guard.
+
+// check-pass
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let mut x: Option<Option<String>> = Some(Some(String::new()));
+ match x {
+ Some(ref mut y) if let Some(ref z) = *y => {
+ let _z: &String = z;
+ let _y: &mut Option<String> = y;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs
new file mode 100644
index 000000000..9353c9d92
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs
@@ -0,0 +1,14 @@
+// Check mutable bindings cannot be mutated by an if-let guard.
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let x: Option<Option<i32>> = Some(Some(6));
+ match x {
+ Some(mut y) if let Some(ref mut z) = y => {
+ //~^ ERROR cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ let _: &mut i32 = z;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr
new file mode 100644
index 000000000..009d15338
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ --> $DIR/guard-mutability-1.rs:8:33
+ |
+LL | Some(mut y) if let Some(ref mut z) = y => {
+ | ^^^^^^^^^ cannot borrow as mutable
+ |
+ = note: variables bound in patterns are immutable until the end of the pattern guard
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs
new file mode 100644
index 000000000..4efa02f57
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs
@@ -0,0 +1,14 @@
+// Check mutable reference bindings cannot be mutated by an if-let guard.
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let mut x: Option<Option<i32>> = Some(Some(6));
+ match x {
+ Some(ref mut y) if let Some(ref mut z) = *y => {
+ //~^ ERROR cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ let _: &mut i32 = z;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr
new file mode 100644
index 000000000..07e7c6a2c
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ --> $DIR/guard-mutability-2.rs:8:37
+ |
+LL | Some(ref mut y) if let Some(ref mut z) = *y => {
+ | ^^^^^^^^^ cannot borrow as mutable
+ |
+ = note: variables bound in patterns are immutable until the end of the pattern guard
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs
new file mode 100644
index 000000000..423a2cd53
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs
@@ -0,0 +1,16 @@
+// Expression macros can't expand to a let match guard.
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+macro_rules! m {
+ ($e:expr) => { let Some(x) = $e }
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn main() {
+ match () {
+ () if m!(Some(5)) => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr
new file mode 100644
index 000000000..00c1c303d
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr
@@ -0,0 +1,14 @@
+error: expected expression, found `let` statement
+ --> $DIR/macro-expanded.rs:7:20
+ |
+LL | ($e:expr) => { let Some(x) = $e }
+ | ^^^
+...
+LL | () if m!(Some(5)) => {}
+ | ----------- in this macro invocation
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs
new file mode 100644
index 000000000..5c333cd77
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs
@@ -0,0 +1,97 @@
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+#![allow(irrefutable_let_patterns)]
+
+fn same_pattern(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x && c => (),
+ (1, 2) if let z = x => (), //~ ERROR use of moved value: `x`
+ _ => (),
+ }
+}
+
+fn same_pattern_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if c && let y = x => (),
+ (1, 2) if let z = x => (),
+ _ => (),
+ }
+}
+
+fn different_patterns(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) if let y = x && c => (),
+ (_, 2) if let z = x => (), //~ ERROR use of moved value: `x`
+ _ => (),
+ }
+}
+
+fn different_patterns_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) if c && let y = x => (),
+ (_, 2) if let z = x => (),
+ _ => (),
+ }
+}
+
+fn or_pattern(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) | (_, 2) if let y = x && c => (), //~ ERROR use of moved value: `x`
+ _ => (),
+ }
+}
+
+fn or_pattern_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) | (_, 2) if c && let y = x => (),
+ _ => (),
+ }
+}
+
+fn use_in_arm(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x && c => false,
+ _ => { *x == 1 }, //~ ERROR use of moved value: `x`
+ };
+}
+
+fn use_in_arm_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if c && let y = x => false,
+ _ => { *x == 1 },
+ };
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
new file mode 100644
index 000000000..d27fde582
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
@@ -0,0 +1,67 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:12:27
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, 2) if let y = x && c => (),
+ | - value moved here
+LL | (1, 2) if let z = x => (),
+ | ^ value used here after move
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, 2) if let ref y = x && c => (),
+ | +++
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:36:27
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, _) if let y = x && c => (),
+ | - value moved here
+LL | (_, 2) if let z = x => (),
+ | ^ value used here after move
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, _) if let ref y = x && c => (),
+ | +++
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:59:36
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, _) | (_, 2) if let y = x && c => (),
+ | - ^ value used here after move
+ | |
+ | value moved here
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, _) | (_, 2) if let ref y = x && c => (),
+ | +++
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:82:16
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, 2) if let y = x && c => false,
+ | - value moved here
+LL | _ => { *x == 1 },
+ | ^^ value used here after move
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, 2) if let ref y = x && c => false,
+ | +++
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs
new file mode 100644
index 000000000..071b86e2e
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs
@@ -0,0 +1,41 @@
+// Check that borrowck knows that moves in the pattern for if-let guards
+// only happen when the pattern is matched.
+
+// build-pass
+
+#![feature(if_let_guard)]
+#![allow(irrefutable_let_patterns)]
+
+fn same_pattern() {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x => (),
+ (1, 2) if let z = x => (),
+ _ => (),
+ }
+}
+
+fn or_pattern() {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) | (_, 2) if let y = x => (),
+ _ => (),
+ }
+}
+
+fn main() {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x => false,
+ _ => { *x == 1 },
+ };
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs
new file mode 100644
index 000000000..f12824db9
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs
@@ -0,0 +1,25 @@
+// Parenthesised let "expressions" are not allowed in guards
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+#[cfg(FALSE)]
+fn un_cfged() {
+ match () {
+ () if let 0 = 1 => {}
+ () if (let 0 = 1) => {}
+ //~^ ERROR expected expression, found `let` statement
+ () if (((let 0 = 1))) => {}
+ //~^ ERROR expected expression, found `let` statement
+ }
+}
+
+fn main() {
+ match () {
+ () if let 0 = 1 => {}
+ () if (let 0 = 1) => {}
+ //~^ ERROR expected expression, found `let` statement
+ () if (((let 0 = 1))) => {}
+ //~^ ERROR expected expression, found `let` statement
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr
new file mode 100644
index 000000000..0c16d9c54
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr
@@ -0,0 +1,54 @@
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:10:16
+ |
+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/parens.rs:10:16
+ |
+LL | () if (let 0 = 1) => {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:12:18
+ |
+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/parens.rs:12:18
+ |
+LL | () if (((let 0 = 1))) => {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:20:16
+ |
+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/parens.rs:20:16
+ |
+LL | () if (let 0 = 1) => {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:22:18
+ |
+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/parens.rs:22:18
+ |
+LL | () if (((let 0 = 1))) => {}
+ | ^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs
new file mode 100644
index 000000000..d91b3a358
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs
@@ -0,0 +1,18 @@
+// Macros can be used for (parts of) the pattern and expression in an if let guard
+// check-pass
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+macro_rules! m {
+ (pattern $i:ident) => { Some($i) };
+ (expression $e:expr) => { $e };
+}
+
+fn main() {
+ match () {
+ () if let m!(pattern x) = m!(expression Some(4)) => {}
+ () if let [m!(pattern y)] = [Some(8 + m!(expression 4))] => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs
new file mode 100644
index 000000000..dba292ef9
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs
@@ -0,0 +1,23 @@
+// Check shadowing in if let guards works as expected.
+// check-pass
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+fn main() {
+ let x: Option<Option<i32>> = Some(Some(6));
+ match x {
+ Some(x) if let Some(x) = x => {
+ let _: i32 = x;
+ }
+ _ => {}
+ }
+
+ let y: Option<Option<Option<i32>>> = Some(Some(Some(-24)));
+ match y {
+ Some(y) if let Some(y) = y && let Some(y) = y => {
+ let _: i32 = y;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs
new file mode 100644
index 000000000..ef7a772e6
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#![feature(if_let_guard)]
+
+struct S;
+
+fn get<T>() -> Option<T> {
+ None
+}
+
+fn main() {
+ match get() {
+ x if let Some(S) = x => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
index b0ac5dc44..e08ffe42d 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
@@ -13,7 +13,6 @@ LL | let foo: fn() = foo;
found fn item `fn() {foo}`
= note: fn items are distinct from fn pointers
= note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers
- = note: when the arguments and return types match, functions can be coerced to function pointers
help: consider casting to a fn pointer
|
LL | let foo: fn() = foo as fn();
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
index b0ac5dc44..e08ffe42d 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
@@ -13,7 +13,6 @@ LL | let foo: fn() = foo;
found fn item `fn() {foo}`
= note: fn items are distinct from fn pointers
= note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers
- = note: when the arguments and return types match, functions can be coerced to function pointers
help: consider casting to a fn pointer
|
LL | let foo: fn() = foo as fn();
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs
index 50e8ce2fd..221c0416d 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs
@@ -5,5 +5,5 @@
#[start]
#[target_feature(enable = "avx2")]
-//~^ ERROR `start` is not allowed to have `#[target_feature]`
+//~^ ERROR `#[start]` function is not allowed to have `#[target_feature]`
fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 }
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr
index 07687f3c7..b49f8afd9 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr
@@ -1,11 +1,11 @@
-error: `start` is not allowed to have `#[target_feature]`
+error: `#[start]` function is not allowed to have `#[target_feature]`
--> $DIR/issue-108645-target-feature-on-start.rs:7:1
|
LL | #[target_feature(enable = "avx2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 }
- | -------------------------------------------------------- `start` is not allowed to have `#[target_feature]`
+ | -------------------------------------------------------- `#[start]` function is not allowed to have `#[target_feature]`
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs
deleted file mode 100644
index f8e033937..000000000
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-// compile-flags:--extern му_сгате
-// edition:2018
-
-use му_сгате::baz; //~ ERROR cannot load a crate with a non-ascii name `му_сгате`
-
-fn main() {}
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr
deleted file mode 100644
index 05fc4fb22..000000000
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: cannot load a crate with a non-ascii name `му_сгате`
- --> $DIR/crate_name_nonascii_forbidden-2.rs:4:5
- |
-LL | use му_сгате::baz;
- | ^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.rs b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.rs
index c07ba54af..c07ba54af 100644
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.rs
+++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.rs
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.stderr b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.stderr
index a8f3abe59..5aade17cb 100644
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.stderr
+++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.stderr
@@ -1,5 +1,5 @@
error: cannot load a crate with a non-ascii name `ьаг`
- --> $DIR/crate_name_nonascii_forbidden-1.rs:1:1
+ --> $DIR/crate_name_nonascii_forbidden.rs:1:1
|
LL | extern crate ьаг;
| ^^^^^^^^^^^^^^^^^
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
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
index 4fcfe9d47..ad11c090f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `T: Foo` is not satisfied
- --> $DIR/assoc-type-const-bound-usage.rs:12:5
+ --> $DIR/assoc-type-const-bound-usage.rs:12:6
|
LL | <T as Foo>::Assoc::foo();
- | ^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
+ | ^ the trait `Foo` is not implemented for `T`
|
help: consider further restricting this bound
|
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
index 2d9c49af8..452bf757d 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `u32: ~const Plus` is not satisfied
- --> $DIR/call-const-trait-method-fail.rs:25:7
+ --> $DIR/call-const-trait-method-fail.rs:25:5
|
LL | a.plus(b)
- | ^^^^ the trait `Plus` is not implemented for `u32`
+ | ^ the trait `Plus` is not implemented for `u32`
|
= help: the trait `Plus` is implemented for `u32`
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
index 2c99d8bf1..15f062edf 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
@@ -1,4 +1,5 @@
-// check-pass
+// known-bug: #110395
+// FIXME check-pass
#![feature(const_trait_impl, const_closures)]
#![allow(incomplete_features)]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr
new file mode 100644
index 000000000..f25390a90
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr
@@ -0,0 +1,8 @@
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-parse-not-item.rs:7:32
+ |
+LL | const fn test() -> impl ~const Fn() {
+ | ^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
index 96ffca651..4c45b0e56 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
@@ -1,15 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closure-trait-method-fail.rs:15:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-trait-method-fail.rs:14:39
|
-LL | x(())
- | ^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 {
- | ++++++++++++++++++++++++++++++++
+LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
+ | ^^^^^^^^^^^^^^^^^
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
index fd0c29118..a8ef244ea 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
@@ -1,15 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closure-trait-method.rs:15:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-trait-method.rs:14:39
|
-LL | x(())
- | ^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 {
- | ++++++++++++++++++++++++++++++++
+LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
+ | ^^^^^^^^^^^^^^^^^
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
index abf2a2dc5..6d61b23e4 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
@@ -1,39 +1,26 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:12:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:8:19
|
-LL | f() * 7
- | ^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | F: ~const FnOnce() -> u8 + ~const std::ops::Fn<()>,
- | +++++++++++++++++++++++++
+LL | F: ~const FnOnce() -> u8,
+ | ^^^^^^^^^^^^^^
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:24:5
- |
-LL | f() + f()
- | ^^^
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:9:19
|
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
- | +++++++++++++++++++++++++
+LL | F: ~const FnMut() -> u8,
+ | ^^^^^^^^^^^^^
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:24:11
- |
-LL | f() + f()
- | ^^^
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:10:19
|
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
+LL | F: ~const Fn() -> u8,
+ | ^^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:23:27
|
-LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
- | +++++++++++++++++++++++++
+LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 {
+ | ^^^^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs
new file mode 100644
index 000000000..da2778f61
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#![feature(effects)]
+
+pub const fn owo() {}
+
+fn main() {
+ // make sure falling back ty/int vars doesn't cause const fallback to be skipped...
+ // See issue: 115791.
+ let _ = 1;
+ if false {
+ let x = panic!();
+ }
+
+ let _ = owo;
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs
new file mode 100644
index 000000000..2f474d978
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs
@@ -0,0 +1,11 @@
+// check-pass
+#![feature(const_trait_impl, effects)]
+
+const fn a() {}
+
+fn foo<F: FnOnce()>(a: F) {}
+
+fn main() {
+ let _ = a;
+ foo(a);
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
index e8d0eec02..c94563d35 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: ~const Bar` is not satisfied
--> $DIR/trait-where-clause-const.rs:21:5
|
LL | T::b();
- | ^^^^ the trait `Bar` is not implemented for `T`
+ | ^ the trait `Bar` is not implemented for `T`
|
note: required by a bound in `Foo::b`
--> $DIR/trait-where-clause-const.rs:15:24
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
index 11f0c4016..255878e17 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Bar` is not satisfied
--> $DIR/trait-where-clause.rs:14:5
|
LL | T::b();
- | ^^^^ the trait `Bar` is not implemented for `T`
+ | ^ the trait `Bar` is not implemented for `T`
|
note: required by a bound in `Foo::b`
--> $DIR/trait-where-clause.rs:8:24