X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir%2Fsrc%2Fdef.rs;h=7416ad79aefd0075a960cb9d36caa14b0d1f0b2f;hb=8385d1713e2507df36f3c33a1eae5539dd6b0f0a;hp=324e110005717ac6517f4f357e4b4dc7c08cc1a2;hpb=976c6b2d193148ca9df3a505e55c5ba5da22cd96;p=rust.git diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs index 324e1100057..7416ad79aef 100644 --- a/compiler/rustc_hir/src/def.rs +++ b/compiler/rustc_hir/src/def.rs @@ -663,4 +663,9 @@ pub fn matches_ns(&self, ns: Namespace) -> bool { 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(..)) + } }