about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/expr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-01-29 19:16:29 +0000
committerbors <bors@rust-lang.org>2025-01-29 19:16:29 +0000
commitae5de6c759cd337ecdb2de4e94f47eaafb5d4606 (patch)
treec3ba73cdd365225357b6803009a52fa1ea341433 /compiler/rustc_ast_lowering/src/expr.rs
parent0cc4f4f7b81f88df6bdd54b41d4a0b1703fd014d (diff)
parent559648a0a4c942993c321d999f708e64f169b245 (diff)
downloadrust-ae5de6c759cd337ecdb2de4e94f47eaafb5d4606.tar.gz
rust-ae5de6c759cd337ecdb2de4e94f47eaafb5d4606.zip
Auto merge of #134248 - oli-obk:patkind-path-removal, r=BoxyUwU
Merge `PatKind::Path` into `PatKind::Expr`

Follow-up to #134228

We always had a duplication where `Path`s could be represented as `PatKind::Path` or `PatKind::Lit(ExprKind::Path)`. We had to handle both everywhere, and still do after #134228, so I'm removing it now.
Diffstat (limited to 'compiler/rustc_ast_lowering/src/expr.rs')
-rw-r--r--compiler/rustc_ast_lowering/src/expr.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index b932915dc29..1267281f73e 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -1391,7 +1391,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
                         None,
                     );
                     // Destructure like a unit struct.
-                    let unit_struct_pat = hir::PatKind::Path(qpath);
+                    let unit_struct_pat = hir::PatKind::Expr(self.arena.alloc(hir::PatExpr {
+                        kind: hir::PatExprKind::Path(qpath),
+                        hir_id: self.next_id(),
+                        span: self.lower_span(lhs.span),
+                    }));
                     return self.pat_without_dbm(lhs.span, unit_struct_pat);
                 }
             }