]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir/src/def.rs
Rollup merge of #96636 - GuillaumeGomez:fix-jump-to-def-regression, r=notriddle
[rust.git] / compiler / rustc_hir / src / def.rs
index ac33a963027f91f10e227d222cb71d25588eab4b..db8807bad40b11985c88a37a87edd9831a5e88f7 100644 (file)
@@ -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(..))
+    }
 }