Rollup merge of #118759 - compiler-errors:bare-unit-structs, r=petrochenkov
Support bare unit structs in destructuring assignments We should be allowed to use destructuring assignments on *bare* unit structs, not just unit structs that are located within other pattern constructors. Fixes #118753 r? petrochenkov since you reviewed #95380, reassign if you're busy or don't want to review this.
This commit is contained in:
commit
dbc6ec6636
9 changed files with 42 additions and 24 deletions
|
@ -1222,6 +1222,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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue