1
Fork 0

Implement destructuring assignment for structs and slices

Co-authored-by: varkor <github@varkor.com>
This commit is contained in:
Fabian Zaiser 2020-11-07 14:28:55 +00:00
parent cf9cf7c923
commit de84ad95b4
32 changed files with 619 additions and 108 deletions

View file

@ -484,4 +484,9 @@ impl<Id> Res<Id> {
pub fn matches_ns(&self, ns: Namespace) -> bool {
self.ns().map_or(true, |actual_ns| actual_ns == ns)
}
/// Returns whether such a resolved path can occur in a tuple struct/variant pattern
pub fn expected_in_tuple_struct_pat(&self) -> bool {
matches!(self, Res::Def(DefKind::Ctor(_, CtorKind::Fn), _) | Res::SelfCtor(..))
}
}