Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/next_solver/def_id.rs')
-rw-r--r--crates/hir-ty/src/next_solver/def_id.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/hir-ty/src/next_solver/def_id.rs b/crates/hir-ty/src/next_solver/def_id.rs
index 1ae59beca2..918a311ea9 100644
--- a/crates/hir-ty/src/next_solver/def_id.rs
+++ b/crates/hir-ty/src/next_solver/def_id.rs
@@ -139,6 +139,17 @@ impl TryFrom<SolverDefId> for GenericDefId {
}
}
+impl SolverDefId {
+ #[inline]
+ #[track_caller]
+ pub fn expect_opaque_ty(self) -> InternedOpaqueTyId {
+ match self {
+ SolverDefId::InternedOpaqueTyId(it) => it,
+ _ => panic!("expected opaque type, found {self:?}"),
+ }
+ }
+}
+
impl<'db> inherent::DefId<DbInterner<'db>> for SolverDefId {
fn as_local(self) -> Option<SolverDefId> {
Some(self)