1
Fork 0

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

@ -657,4 +657,9 @@ impl<Id> Res<Id> {
pub fn expected_in_tuple_struct_pat(&self) -> bool {
matches!(self, Res::Def(DefKind::Ctor(_, CtorKind::Fn), _) | Res::SelfCtor(..))
}
/// Returns whether such a resolved path can occur in a unit struct/variant pattern
pub fn expected_in_unit_struct_pat(&self) -> bool {
matches!(self, Res::Def(DefKind::Ctor(_, CtorKind::Const), _) | Res::SelfCtor(..))
}
}