This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
compiler/rustc_ast_lowering/src Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -347,8 +347,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
347
347
) -> hir:: ExprKind < ' hir > {
348
348
macro_rules! make_if {
349
349
( $opt: expr) => { {
350
+ let cond = self . lower_expr( cond) ;
350
351
let then_expr = self . lower_block_expr( then) ;
351
- hir:: ExprKind :: If ( self . lower_expr ( cond) , self . arena. alloc( then_expr) , $opt)
352
+ hir:: ExprKind :: If ( cond, self . arena. alloc( then_expr) , $opt)
352
353
} } ;
353
354
}
354
355
if let Some ( rslt) = else_opt {
Original file line number Diff line number Diff line change
1
+ #![ feature( let_chains) ] //~ WARN the feature `let_chains` is incomplete
2
+
3
+ fn main ( ) {
4
+ if true && let x = 1 { //~ ERROR `let` expressions are not supported here
5
+ let _ = x;
6
+ }
7
+ }
Original file line number Diff line number Diff line change
1
+ error: `let` expressions are not supported here
2
+ --> $DIR/issue-82290.rs:4:16
3
+ |
4
+ LL | if true && let x = 1 {
5
+ | ^^^^^^^^^
6
+ |
7
+ = note: only supported directly in conditions of `if`- and `while`-expressions
8
+ = note: as well as when nested within `&&` and parenthesis in those conditions
9
+
10
+ warning: the feature `let_chains` is incomplete and may not be safe to use and/or cause compiler crashes
11
+ --> $DIR/issue-82290.rs:1:12
12
+ |
13
+ LL | #![feature(let_chains)]
14
+ | ^^^^^^^^^^
15
+ |
16
+ = note: `#[warn(incomplete_features)]` on by default
17
+ = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
18
+
19
+ error: aborting due to previous error; 1 warning emitted
20
+
You can’t perform that action at this time.
0 commit comments