From 0cbee3bba577475f896413e48f89e23d86463c02 Mon Sep 17 00:00:00 2001 From: Vincent Esche Date: Tue, 16 Jul 2024 18:17:06 +0200 Subject: [PATCH] =?UTF-8?q?Add=20method=20`Impl::all=5Fin=5Fmodule(?= =?UTF-8?q?=E2=80=A6)`=20for=20supporting=20more=20localized=20querying?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tools/rust-analyzer/crates/hir/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools/rust-analyzer/crates/hir/src/lib.rs b/src/tools/rust-analyzer/crates/hir/src/lib.rs index 32057fbaff01..dd9f1e880369 100644 --- a/src/tools/rust-analyzer/crates/hir/src/lib.rs +++ b/src/tools/rust-analyzer/crates/hir/src/lib.rs @@ -3724,6 +3724,10 @@ impl Impl { inherent.all_impls().chain(trait_.all_impls()).map(Self::from).collect() } + pub fn all_in_module(db: &dyn HirDatabase, module: Module) -> Vec { + module.id.def_map(db.upcast())[module.id.local_id].scope.impls().map(Into::into).collect() + } + pub fn all_for_type(db: &dyn HirDatabase, Type { ty, env }: Type) -> Vec { let def_crates = match method_resolution::def_crates(db, &ty, env.krate) { Some(def_crates) => def_crates,