]> git.lizzy.rs Git - rust.git/blobdiff - crates/hir_def/src/expr.rs
Merge #11461
[rust.git] / crates / hir_def / src / expr.rs
index 6534f970ee6b860f245fa89f6073f921ab07adf4..4dca8238880d9376833bf406c65369e8550737fe 100644 (file)
@@ -59,6 +59,10 @@ pub enum Expr {
         then_branch: ExprId,
         else_branch: Option<ExprId>,
     },
+    Let {
+        pat: PatId,
+        expr: ExprId,
+    },
     Block {
         id: BlockId,
         statements: Box<[Statement]>,
@@ -189,17 +193,10 @@ pub enum Array {
 #[derive(Debug, Clone, Eq, PartialEq)]
 pub struct MatchArm {
     pub pat: PatId,
-    pub guard: Option<MatchGuard>,
+    pub guard: Option<ExprId>,
     pub expr: ExprId,
 }
 
-#[derive(Debug, Clone, Eq, PartialEq)]
-pub enum MatchGuard {
-    If { expr: ExprId },
-
-    IfLet { pat: PatId, expr: ExprId },
-}
-
 #[derive(Debug, Clone, Eq, PartialEq)]
 pub struct RecordLitField {
     pub name: Name,
@@ -232,6 +229,9 @@ pub fn walk_child_exprs(&self, mut f: impl FnMut(ExprId)) {
                     f(else_branch);
                 }
             }
+            Expr::Let { expr, .. } => {
+                f(*expr);
+            }
             Expr::Block { statements, tail, .. } => {
                 for stmt in statements.iter() {
                     match stmt {