Skip to content

Commit 475bb38

Browse files
committed
let_chains: Remove ast::ExprKind::{IfLet, WhileLet} and introduce ::Let.
1 parent 372be4f commit 475bb38

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/libsyntax/ast.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,10 +1049,9 @@ impl Expr {
10491049
ExprKind::Unary(..) => ExprPrecedence::Unary,
10501050
ExprKind::Lit(_) => ExprPrecedence::Lit,
10511051
ExprKind::Type(..) | ExprKind::Cast(..) => ExprPrecedence::Cast,
1052+
ExprKind::Let(..) => ExprPrecedence::Let,
10521053
ExprKind::If(..) => ExprPrecedence::If,
1053-
ExprKind::IfLet(..) => ExprPrecedence::IfLet,
10541054
ExprKind::While(..) => ExprPrecedence::While,
1055-
ExprKind::WhileLet(..) => ExprPrecedence::WhileLet,
10561055
ExprKind::ForLoop(..) => ExprPrecedence::ForLoop,
10571056
ExprKind::Loop(..) => ExprPrecedence::Loop,
10581057
ExprKind::Match(..) => ExprPrecedence::Match,
@@ -1135,26 +1134,17 @@ pub enum ExprKind {
11351134
Cast(P<Expr>, P<Ty>),
11361135
/// A type ascription (e.g., `42: usize`).
11371136
Type(P<Expr>, P<Ty>),
1137+
/// A `let pat = expr` pseudo-expression that only occurs in the scrutinee
1138+
/// of `if` / `while` expressions. (e.g., `if let 0 = x { .. }`).
1139+
Let(Vec<P<Pat>>, P<Expr>),
11381140
/// An `if` block, with an optional `else` block.
11391141
///
11401142
/// `if expr { block } else { expr }`
11411143
If(P<Expr>, P<Block>, Option<P<Expr>>),
1142-
/// An `if let` expression with an optional else block
1143-
///
1144-
/// `if let pat = expr { block } else { expr }`
1145-
///
1146-
/// This is desugared to a `match` expression.
1147-
IfLet(Vec<P<Pat>>, P<Expr>, P<Block>, Option<P<Expr>>),
1148-
/// A while loop, with an optional label
1144+
/// A while loop, with an optional label.
11491145
///
11501146
/// `'label: while expr { block }`
11511147
While(P<Expr>, P<Block>, Option<Label>),
1152-
/// A `while let` loop, with an optional label.
1153-
///
1154-
/// `'label: while let pat = expr { block }`
1155-
///
1156-
/// This is desugared to a combination of `loop` and `match` expressions.
1157-
WhileLet(Vec<P<Pat>>, P<Expr>, P<Block>, Option<Label>),
11581148
/// A `for` loop, with an optional label.
11591149
///
11601150
/// `'label: for pat in expr { block }`

0 commit comments

Comments
 (0)