From 12bf008ab12f87b2e6d4805681f5a389d9e2f425 Mon Sep 17 00:00:00 2001 From: Fedor Sakharov Date: Thu, 14 May 2020 13:47:36 +0300 Subject: Adds a param_idx helper --- crates/ra_hir_ty/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/ra_hir_ty/src') diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs index e8f3482fe..ccc4348f4 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/ra_hir_ty/src/lib.rs @@ -427,6 +427,11 @@ impl Substs { } } +/// Return an index of a parameter in the generic type parameter list by it's id. +pub fn param_idx(db: &dyn HirDatabase, id: TypeParamId) -> Option { + generics(db.upcast(), id.parent).param_idx(id) +} + #[derive(Debug, Clone)] pub struct SubstsBuilder { vec: Vec, -- cgit v1.2.3