about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-12-08 19:54:46 +0000
committerMichael Goulet <michael@errs.io>2023-12-08 19:55:07 +0000
commitd473bdfdc3a2c377afd873abd4ace4244af80766 (patch)
tree2d81dc0a2064a125b1f2cb86eae4679fa2e7758e /compiler/rustc_ast_lowering/src
parentae612bedcbfc7098d1711eb35bc7ca994eb17a4c (diff)
downloadrust-d473bdfdc3a2c377afd873abd4ace4244af80766.tar.gz
rust-d473bdfdc3a2c377afd873abd4ace4244af80766.zip
Support bare unit structs in destructuring assignments
Diffstat (limited to 'compiler/rustc_ast_lowering/src')
-rw-r--r--compiler/rustc_ast_lowering/src/expr.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index 3556ee02bd7..dfe3a0d84f4 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -1084,6 +1084,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
                 | ExprKind::Struct(..)
                 | ExprKind::Tup(..)
                 | ExprKind::Underscore => false,
+                // Check for unit struct constructor.
+                ExprKind::Path(..) => lower_ctx.extract_unit_struct_path(lhs).is_none(),
                 // Check for tuple struct constructor.
                 ExprKind::Call(callee, ..) => lower_ctx.extract_tuple_struct_path(callee).is_none(),
                 ExprKind::Paren(e) => {