Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/next_solver/generic_arg.rs')
-rw-r--r--crates/hir-ty/src/next_solver/generic_arg.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/hir-ty/src/next_solver/generic_arg.rs b/crates/hir-ty/src/next_solver/generic_arg.rs
index 90bd44aee8..dedd6a1a6d 100644
--- a/crates/hir-ty/src/next_solver/generic_arg.rs
+++ b/crates/hir-ty/src/next_solver/generic_arg.rs
@@ -63,6 +63,14 @@ impl<'db> GenericArg<'db> {
}
}
+ #[inline]
+ pub(crate) fn expect_region(self) -> Region<'db> {
+ match self {
+ GenericArg::Lifetime(region) => region,
+ _ => panic!("expected a region, got {self:?}"),
+ }
+ }
+
pub fn error_from_id(interner: DbInterner<'db>, id: GenericParamId) -> GenericArg<'db> {
match id {
GenericParamId::TypeParamId(_) => Ty::new_error(interner, ErrorGuaranteed).into(),