aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_db/src')
-rw-r--r--crates/ide_db/src/defs.rs2
-rw-r--r--crates/ide_db/src/search.rs16
2 files changed, 16 insertions, 2 deletions
diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs
index ff612b7d0..f86e5ce93 100644
--- a/crates/ide_db/src/defs.rs
+++ b/crates/ide_db/src/defs.rs
@@ -70,7 +70,7 @@ impl Definition {
70 hir::ModuleDef::Static(it) => it.name(db)?, 70 hir::ModuleDef::Static(it) => it.name(db)?,
71 hir::ModuleDef::Trait(it) => it.name(db), 71 hir::ModuleDef::Trait(it) => it.name(db),
72 hir::ModuleDef::TypeAlias(it) => it.name(db), 72 hir::ModuleDef::TypeAlias(it) => it.name(db),
73 hir::ModuleDef::BuiltinType(_) => return None, 73 hir::ModuleDef::BuiltinType(it) => it.name(),
74 }, 74 },
75 Definition::SelfType(_) => return None, 75 Definition::SelfType(_) => return None,
76 Definition::Local(it) => it.name(db)?, 76 Definition::Local(it) => it.name(db)?,
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs
index fa18703e1..d00a8b6e7 100644
--- a/crates/ide_db/src/search.rs
+++ b/crates/ide_db/src/search.rs
@@ -6,7 +6,7 @@
6 6
7use std::{convert::TryInto, mem}; 7use std::{convert::TryInto, mem};
8 8
9use base_db::{FileId, FileRange, SourceDatabaseExt}; 9use base_db::{FileId, FileRange, SourceDatabase, SourceDatabaseExt};
10use hir::{DefWithBody, HasSource, Module, ModuleSource, Semantics, Visibility}; 10use hir::{DefWithBody, HasSource, Module, ModuleSource, Semantics, Visibility};
11use once_cell::unsync::Lazy; 11use once_cell::unsync::Lazy;
12use rustc_hash::FxHashMap; 12use rustc_hash::FxHashMap;
@@ -138,6 +138,20 @@ impl IntoIterator for SearchScope {
138impl Definition { 138impl Definition {
139 fn search_scope(&self, db: &RootDatabase) -> SearchScope { 139 fn search_scope(&self, db: &RootDatabase) -> SearchScope {
140 let _p = profile::span("search_scope"); 140 let _p = profile::span("search_scope");
141
142 if let Definition::ModuleDef(hir::ModuleDef::BuiltinType(_)) = self {
143 let mut res = FxHashMap::default();
144
145 let graph = db.crate_graph();
146 for krate in graph.iter() {
147 let root_file = graph[krate].root_file_id;
148 let source_root_id = db.file_source_root(root_file);
149 let source_root = db.source_root(source_root_id);
150 res.extend(source_root.iter().map(|id| (id, None)));
151 }
152 return SearchScope::new(res);
153 }
154
141 let module = match self.module(db) { 155 let module = match self.module(db) {
142 Some(it) => it, 156 Some(it) => it,
143 None => return SearchScope::empty(), 157 None => return SearchScope::empty(),