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.rs9
1 files changed, 9 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 3e4c4171be..789be3b731 100644
--- a/crates/hir-ty/src/next_solver/def_id.rs
+++ b/crates/hir-ty/src/next_solver/def_id.rs
@@ -158,6 +158,15 @@ impl SolverDefId {
_ => panic!("expected opaque type, found {self:?}"),
}
}
+
+ #[inline]
+ #[track_caller]
+ pub fn expect_type_alias(self) -> TypeAliasId {
+ match self {
+ SolverDefId::TypeAliasId(it) => it,
+ _ => panic!("expected type alias, found {self:?}"),
+ }
+ }
}
impl<'db> inherent::DefId<DbInterner<'db>> for SolverDefId {