Fix unit struct/enum variant in destructuring assignment
This commit is contained in:
parent
8f36334ca9
commit
17f5c4d255
4 changed files with 80 additions and 7 deletions
|
@ -309,13 +309,10 @@ impl<'a> PathSource<'a> {
|
|||
) | Res::Local(..)
|
||||
| Res::SelfCtor(..)
|
||||
),
|
||||
PathSource::Pat => matches!(
|
||||
res,
|
||||
Res::Def(
|
||||
DefKind::Ctor(_, CtorKind::Const) | DefKind::Const | DefKind::AssocConst,
|
||||
_,
|
||||
) | Res::SelfCtor(..)
|
||||
),
|
||||
PathSource::Pat => {
|
||||
res.expected_in_unit_struct_pat()
|
||||
|| matches!(res, Res::Def(DefKind::Const | DefKind::AssocConst, _))
|
||||
}
|
||||
PathSource::TupleStruct(..) => res.expected_in_tuple_struct_pat(),
|
||||
PathSource::Struct => matches!(
|
||||
res,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue