X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir%2Fsrc%2Fdef.rs;h=db8807bad40b11985c88a37a87edd9831a5e88f7;hb=3346d11f4e8521894377636f145bfc68fad10bea;hp=ac33a963027f91f10e227d222cb71d25588eab4b;hpb=7907385999b4a83d37ed31d334f3ed9ca02983a1;p=rust.git diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs index ac33a963027..db8807bad40 100644 --- a/compiler/rustc_hir/src/def.rs +++ b/compiler/rustc_hir/src/def.rs @@ -664,4 +664,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(..)) + } }