Fix unit struct/enum variant in destructuring assignment

This commit is contained in:
Michael Goulet 2022-04-01 20:24:32 -07:00
parent 8f36334ca9
commit 17f5c4d255
4 changed files with 80 additions and 7 deletions

View file

@ -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,