diff options
author | Fedor Sakharov <[email protected]> | 2020-05-14 11:47:36 +0100 |
---|---|---|
committer | Fedor Sakharov <[email protected]> | 2020-05-14 11:47:36 +0100 |
commit | 12bf008ab12f87b2e6d4805681f5a389d9e2f425 (patch) | |
tree | d0e4a40066d1ddbe0d9819a0c300480433bc8a79 /crates/ra_hir_ty/src | |
parent | 2dfbec149f6de3fe8e64680521aa6076928b24f9 (diff) |
Adds a param_idx helper
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r-- | crates/ra_hir_ty/src/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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 { | |||
427 | } | 427 | } |
428 | } | 428 | } |
429 | 429 | ||
430 | /// Return an index of a parameter in the generic type parameter list by it's id. | ||
431 | pub fn param_idx(db: &dyn HirDatabase, id: TypeParamId) -> Option<usize> { | ||
432 | generics(db.upcast(), id.parent).param_idx(id) | ||
433 | } | ||
434 | |||
430 | #[derive(Debug, Clone)] | 435 | #[derive(Debug, Clone)] |
431 | pub struct SubstsBuilder { | 436 | pub struct SubstsBuilder { |
432 | vec: Vec<Ty>, | 437 | vec: Vec<Ty>, |