Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/lib.rs')
| -rw-r--r-- | crates/hir/src/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index fc6a398ed3..24faa127e4 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -3599,6 +3599,14 @@ impl Type { _ => None, } } + + /// Returns unique `GenericParam`s contained in this type. + pub fn generic_params(&self, db: &dyn HirDatabase) -> FxHashSet<GenericParam> { + hir_ty::collect_placeholders(&self.ty, db) + .into_iter() + .map(|id| TypeOrConstParam { id }.split(db).either_into()) + .collect() + } } #[derive(Debug)] |