Account for if (let pat = expr) {}

Partially address #82827.
This commit is contained in:
Esteban Küber
2021-03-06 18:29:41 -08:00
parent 1c77a1fa3c
commit e62a543344
8 changed files with 216 additions and 231 deletions

View File

@@ -1139,6 +1139,14 @@ impl Expr {
}
}
pub fn peel_parens(&self) -> &Expr {
let mut expr = self;
while let ExprKind::Paren(inner) = &expr.kind {
expr = &inner;
}
expr
}
/// Attempts to reparse as `Ty` (for diagnostic purposes).
pub fn to_ty(&self) -> Option<P<Ty>> {
let kind = match &self.kind {

View File

@@ -97,6 +97,23 @@ impl<'hir> LoweringContext<'_, 'hir> {
ExprKind::Let(ref pat, ref scrutinee) => {
self.lower_expr_if_let(e.span, pat, scrutinee, then, else_opt.as_deref())
}
ExprKind::Paren(ref paren) => match paren.peel_parens().kind {
ExprKind::Let(ref pat, ref scrutinee) => {
// A user has written `if (let Some(x) = foo) {`, we want to avoid
// confusing them with mentions of nightly features.
// If this logic is changed, you will also likely need to touch
// `unused::UnusedParens::check_expr`.
self.if_let_expr_with_parens(cond, &paren.peel_parens());
self.lower_expr_if_let(
e.span,
pat,
scrutinee,
then,
else_opt.as_deref(),
)
}
_ => self.lower_expr_if(cond, then, else_opt.as_deref()),
},
_ => self.lower_expr_if(cond, then, else_opt.as_deref()),
},
ExprKind::While(ref cond, ref body, opt_label) => self
@@ -346,6 +363,32 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::ExprKind::Call(f, self.lower_exprs(&real_args))
}
fn if_let_expr_with_parens(&mut self, cond: &Expr, paren: &Expr) {
let start = cond.span.until(paren.span);
let end = paren.span.shrink_to_hi().until(cond.span.shrink_to_hi());
let mut err = self.sess.struct_span_err(
vec![start, end],
"invalid parentheses around `let` expression in `if let`",
);
if self.sess.opts.unstable_features.is_nightly_build() {
err.note(
"only supported directly without parentheses in conditions of `if`- and \
`while`-expressions, as well as in `let` chains within parentheses",
);
} else {
err.note("variable declaration using `let` is a statement, not a condition");
}
err.multipart_suggestion(
"`if let` needs to be written without parentheses",
vec![(start, String::new()), (end, String::new())],
rustc_errors::Applicability::MachineApplicable,
);
err.emit();
// Ideally, we'd remove the feature gating of a `let` expression since we are already
// complaining about it here, but `feature_gate::check_crate` has already run by now:
// self.sess.parse_sess.gated_spans.ungate_last(sym::let_chains, paren.span);
}
/// Emit an error and lower `ast::ExprKind::Let(pat, scrutinee)` into:
/// ```rust
/// match scrutinee { pats => true, _ => false }
@@ -356,8 +399,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
if self.sess.opts.unstable_features.is_nightly_build() {
self.sess
.struct_span_err(span, "`let` expressions are not supported here")
.note("only supported directly in conditions of `if`- and `while`-expressions")
.note("as well as when nested within `&&` and parenthesis in those conditions")
.note(
"only supported directly without parentheses in conditions of `if`- and \
`while`-expressions, as well as in `let` chains within parentheses",
)
.emit();
} else {
self.sess

View File

@@ -602,7 +602,7 @@ trait UnusedDelimLint {
use rustc_ast::ExprKind::*;
let (value, ctx, followed_by_block, left_pos, right_pos) = match e.kind {
// Do not lint `unused_braces` in `if let` expressions.
If(ref cond, ref block, ..)
If(ref cond, ref block, _)
if !matches!(cond.kind, Let(_, _)) || Self::LINT_EXPR_IN_PATTERN_MATCHING_CTX =>
{
let left = e.span.lo() + rustc_span::BytePos(2);
@@ -816,9 +816,34 @@ impl UnusedParens {
impl EarlyLintPass for UnusedParens {
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
if let ExprKind::Let(ref pat, ..) | ExprKind::ForLoop(ref pat, ..) = e.kind {
match e.kind {
ExprKind::Let(ref pat, _) | ExprKind::ForLoop(ref pat, ..) => {
self.check_unused_parens_pat(cx, pat, false, false);
}
// We ignore parens in cases like `if (((let Some(0) = Some(1))))` because we already
// handle a hard error for them during AST lowering in `lower_expr_mut`, but we still
// want to complain about things like `if let 42 = (42)`.
ExprKind::If(ref cond, ref block, ref else_)
if matches!(cond.peel_parens().kind, ExprKind::Let(..)) =>
{
self.check_unused_delims_expr(
cx,
cond.peel_parens(),
UnusedDelimsCtx::LetScrutineeExpr,
true,
None,
None,
);
for stmt in &block.stmts {
<Self as UnusedDelimLint>::check_stmt(self, cx, stmt);
}
if let Some(e) = else_ {
<Self as UnusedDelimLint>::check_expr(self, cx, e);
}
return;
}
_ => {}
}
<Self as UnusedDelimLint>::check_expr(self, cx, e)
}

View File

@@ -4,8 +4,7 @@ error: `let` expressions are not supported here
LL | if true && let x = 1 {
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
warning: the feature `let_chains` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-82290.rs:1:12

View File

@@ -175,8 +175,7 @@ error: `let` expressions are not supported here
LL | () if (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:14:18
@@ -184,8 +183,7 @@ error: `let` expressions are not supported here
LL | () if (((let 0 = 1))) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:18:23
@@ -193,8 +191,7 @@ error: `let` expressions are not supported here
LL | () if true && let 0 = 1 => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:22:15
@@ -202,8 +199,7 @@ error: `let` expressions are not supported here
LL | () if let 0 = 1 && true => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:26:16
@@ -211,8 +207,7 @@ error: `let` expressions are not supported here
LL | () if (let 0 = 1) && true => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:30:24
@@ -220,8 +215,7 @@ error: `let` expressions are not supported here
LL | () if true && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:34:16
@@ -229,8 +223,7 @@ error: `let` expressions are not supported here
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:34:31
@@ -238,8 +231,7 @@ error: `let` expressions are not supported here
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:40:15
@@ -247,8 +239,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:40:28
@@ -256,8 +247,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:40:42
@@ -265,8 +255,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:40:55
@@ -274,8 +263,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:40:68
@@ -283,8 +271,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:52:15
@@ -292,8 +279,7 @@ error: `let` expressions are not supported here
LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:68:16
@@ -301,8 +287,7 @@ error: `let` expressions are not supported here
LL | use_expr!((let 0 = 1 && 0 == 0));
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:71:16
@@ -310,8 +295,7 @@ error: `let` expressions are not supported here
LL | use_expr!((let 0 = 1));
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: aborting due to 35 previous errors

View File

@@ -15,8 +15,7 @@ error: `let` expressions are not supported here
LL | if &let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:35:9
@@ -24,8 +23,7 @@ error: `let` expressions are not supported here
LL | if !let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:36:9
@@ -33,8 +31,7 @@ error: `let` expressions are not supported here
LL | if *let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:38:9
@@ -42,8 +39,7 @@ error: `let` expressions are not supported here
LL | if -let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:46:9
@@ -51,8 +47,7 @@ error: `let` expressions are not supported here
LL | if (let 0 = 0)? {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:50:16
@@ -60,8 +55,7 @@ error: `let` expressions are not supported here
LL | if true || let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:51:17
@@ -69,8 +63,7 @@ error: `let` expressions are not supported here
LL | if (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:52:25
@@ -78,8 +71,7 @@ error: `let` expressions are not supported here
LL | if true && (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:53:25
@@ -87,8 +79,7 @@ error: `let` expressions are not supported here
LL | if true || (true && let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:56:12
@@ -96,8 +87,7 @@ error: `let` expressions are not supported here
LL | if x = let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:59:15
@@ -105,8 +95,7 @@ error: `let` expressions are not supported here
LL | if true..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:61:11
@@ -114,8 +103,7 @@ error: `let` expressions are not supported here
LL | if ..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:63:9
@@ -123,8 +111,7 @@ error: `let` expressions are not supported here
LL | if (let 0 = 0).. {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:67:8
@@ -132,8 +119,7 @@ error: `let` expressions are not supported here
LL | if let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:71:8
@@ -141,8 +127,7 @@ error: `let` expressions are not supported here
LL | if let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:78:8
@@ -150,8 +135,7 @@ error: `let` expressions are not supported here
LL | if let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:86:8
@@ -159,8 +143,7 @@ error: `let` expressions are not supported here
LL | if let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:92:19
@@ -168,8 +151,7 @@ error: `let` expressions are not supported here
LL | if let true = let true = true {}
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:96:12
@@ -177,8 +159,7 @@ error: `let` expressions are not supported here
LL | while &let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:99:12
@@ -186,8 +167,7 @@ error: `let` expressions are not supported here
LL | while !let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:100:12
@@ -195,8 +175,7 @@ error: `let` expressions are not supported here
LL | while *let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:102:12
@@ -204,8 +183,7 @@ error: `let` expressions are not supported here
LL | while -let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:110:12
@@ -213,8 +191,7 @@ error: `let` expressions are not supported here
LL | while (let 0 = 0)? {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:114:19
@@ -222,8 +199,7 @@ error: `let` expressions are not supported here
LL | while true || let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:115:20
@@ -231,8 +207,7 @@ error: `let` expressions are not supported here
LL | while (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:116:28
@@ -240,8 +215,7 @@ error: `let` expressions are not supported here
LL | while true && (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:117:28
@@ -249,8 +223,7 @@ error: `let` expressions are not supported here
LL | while true || (true && let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:120:15
@@ -258,8 +231,7 @@ error: `let` expressions are not supported here
LL | while x = let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:123:18
@@ -267,8 +239,7 @@ error: `let` expressions are not supported here
LL | while true..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:125:14
@@ -276,8 +247,7 @@ error: `let` expressions are not supported here
LL | while ..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:127:12
@@ -285,8 +255,7 @@ error: `let` expressions are not supported here
LL | while (let 0 = 0).. {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:131:11
@@ -294,8 +263,7 @@ error: `let` expressions are not supported here
LL | while let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:135:11
@@ -303,8 +271,7 @@ error: `let` expressions are not supported here
LL | while let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:142:11
@@ -312,8 +279,7 @@ error: `let` expressions are not supported here
LL | while let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:150:11
@@ -321,8 +287,7 @@ error: `let` expressions are not supported here
LL | while let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:156:22
@@ -330,8 +295,7 @@ error: `let` expressions are not supported here
LL | while let true = let true = true {}
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:170:6
@@ -339,8 +303,7 @@ error: `let` expressions are not supported here
LL | &let 0 = 0;
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:172:6
@@ -348,8 +311,7 @@ error: `let` expressions are not supported here
LL | !let 0 = 0;
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:173:6
@@ -357,8 +319,7 @@ error: `let` expressions are not supported here
LL | *let 0 = 0;
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:175:6
@@ -366,8 +327,7 @@ error: `let` expressions are not supported here
LL | -let 0 = 0;
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:183:6
@@ -375,8 +335,7 @@ error: `let` expressions are not supported here
LL | (let 0 = 0)?;
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:187:13
@@ -384,8 +343,7 @@ error: `let` expressions are not supported here
LL | true || let 0 = 0;
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:188:14
@@ -393,8 +351,7 @@ error: `let` expressions are not supported here
LL | (true || let 0 = 0);
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:189:22
@@ -402,8 +359,7 @@ error: `let` expressions are not supported here
LL | true && (true || let 0 = 0);
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:192:9
@@ -411,8 +367,7 @@ error: `let` expressions are not supported here
LL | x = let 0 = 0;
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:194:12
@@ -420,8 +375,7 @@ error: `let` expressions are not supported here
LL | true..(let 0 = 0);
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:195:8
@@ -429,8 +383,7 @@ error: `let` expressions are not supported here
LL | ..(let 0 = 0);
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:196:6
@@ -438,8 +391,7 @@ error: `let` expressions are not supported here
LL | (let 0 = 0)..;
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:198:6
@@ -447,8 +399,7 @@ error: `let` expressions are not supported here
LL | (let Range { start: _, end: _ } = true..true || false);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:202:6
@@ -456,8 +407,7 @@ error: `let` expressions are not supported here
LL | (let true = let true = true);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:202:17
@@ -465,8 +415,7 @@ error: `let` expressions are not supported here
LL | (let true = let true = true);
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:207:6
@@ -474,8 +423,7 @@ error: `let` expressions are not supported here
LL | &let 0 = 0
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:218:17
@@ -483,8 +431,7 @@ error: `let` expressions are not supported here
LL | true && let 1 = 1
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:222:17
@@ -492,8 +439,7 @@ error: `let` expressions are not supported here
LL | true && let 1 = 1
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:226:17
@@ -501,8 +447,7 @@ error: `let` expressions are not supported here
LL | true && let 1 = 1
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/disallowed-positions.rs:236:17
@@ -510,8 +455,7 @@ error: `let` expressions are not supported here
LL | true && let 1 = 1
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/disallowed-positions.rs:20:12

View File

@@ -13,11 +13,11 @@ fn _if() {
if (let 0 = 1) {}
//~^ ERROR `let` expressions in this position are experimental [E0658]
//~| ERROR `let` expressions are not supported here
//~| ERROR invalid parentheses around `let` expression in `if let`
if (((let 0 = 1))) {}
//~^ ERROR `let` expressions in this position are experimental [E0658]
//~| ERROR `let` expressions are not supported here
//~| ERROR invalid parentheses around `let` expression in `if let`
if true && let 0 = 1 {}
//~^ ERROR `let` expressions in this position are experimental [E0658]
@@ -126,7 +126,7 @@ fn _macros() {
//~| ERROR `let` expressions are not supported here
use_expr!((let 0 = 1));
//~^ ERROR `let` expressions in this position are experimental [E0658]
//~| ERROR `let` expressions are not supported here
//~| ERROR invalid parentheses around `let` expression in `if let`
//~| ERROR `let` expressions are not supported here
#[cfg(FALSE)] (let 0 = 1);
//~^ ERROR `let` expressions in this position are experimental [E0658]

View File

@@ -295,23 +295,29 @@ 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: `let` expressions are not supported here
--> $DIR/feature-gate.rs:14:9
error: invalid parentheses around `let` expression in `if let`
--> $DIR/feature-gate.rs:14:8
|
LL | if (let 0 = 1) {}
| ^^^^^^^^^
| ^ ^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
help: `if let` needs to be written without parentheses
|
LL | if let 0 = 1 {}
| -- --
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:18:11
error: invalid parentheses around `let` expression in `if let`
--> $DIR/feature-gate.rs:18:8
|
LL | if (((let 0 = 1))) {}
| ^^^^^^^^^
| ^^^ ^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
help: `if let` needs to be written without parentheses
|
LL | if let 0 = 1 {}
| -- --
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:22:16
@@ -319,8 +325,7 @@ error: `let` expressions are not supported here
LL | if true && let 0 = 1 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:26:8
@@ -328,8 +333,7 @@ error: `let` expressions are not supported here
LL | if let 0 = 1 && true {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:30:9
@@ -337,8 +341,7 @@ error: `let` expressions are not supported here
LL | if (let 0 = 1) && true {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:34:17
@@ -346,8 +349,7 @@ error: `let` expressions are not supported here
LL | if true && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:38:9
@@ -355,8 +357,7 @@ error: `let` expressions are not supported here
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:38:24
@@ -364,8 +365,7 @@ error: `let` expressions are not supported here
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:44:8
@@ -373,8 +373,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:44:21
@@ -382,8 +381,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:44:35
@@ -391,8 +389,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:44:48
@@ -400,8 +397,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:44:61
@@ -409,8 +405,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:56:8
@@ -418,8 +413,7 @@ error: `let` expressions are not supported here
LL | if let Range { start: _, end: _ } = (true..true) && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:64:12
@@ -427,8 +421,7 @@ error: `let` expressions are not supported here
LL | while (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:68:14
@@ -436,8 +429,7 @@ error: `let` expressions are not supported here
LL | while (((let 0 = 1))) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:72:19
@@ -445,8 +437,7 @@ error: `let` expressions are not supported here
LL | while true && let 0 = 1 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:76:11
@@ -454,8 +445,7 @@ error: `let` expressions are not supported here
LL | while let 0 = 1 && true {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:80:12
@@ -463,8 +453,7 @@ error: `let` expressions are not supported here
LL | while (let 0 = 1) && true {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:84:20
@@ -472,8 +461,7 @@ error: `let` expressions are not supported here
LL | while true && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:88:12
@@ -481,8 +469,7 @@ error: `let` expressions are not supported here
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:88:27
@@ -490,8 +477,7 @@ error: `let` expressions are not supported here
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:94:11
@@ -499,8 +485,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:94:24
@@ -508,8 +493,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:94:38
@@ -517,8 +501,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:94:51
@@ -526,8 +509,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:94:64
@@ -535,8 +517,7 @@ error: `let` expressions are not supported here
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: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:106:11
@@ -544,8 +525,7 @@ error: `let` expressions are not supported here
LL | while let Range { start: _, end: _ } = (true..true) && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:123:16
@@ -553,8 +533,7 @@ error: `let` expressions are not supported here
LL | use_expr!((let 0 = 1 && 0 == 0));
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:123:16
@@ -562,8 +541,19 @@ error: `let` expressions are not supported here
LL | use_expr!((let 0 = 1 && 0 == 0));
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: invalid parentheses around `let` expression in `if let`
--> $DIR/feature-gate.rs:127:15
|
LL | use_expr!((let 0 = 1));
| ^ ^
|
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
help: `if let` needs to be written without parentheses
|
LL | use_expr!(let 0 = 1);
| -- --
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:127:16
@@ -571,17 +561,7 @@ error: `let` expressions are not supported here
LL | use_expr!((let 0 = 1));
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
error: `let` expressions are not supported here
--> $DIR/feature-gate.rs:127:16
|
LL | use_expr!((let 0 = 1));
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions
= note: only supported directly without parentheses in conditions of `if`- and `while`-expressions, as well as in `let` chains within parentheses
error: aborting due to 65 previous errors