aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2021-06-10 21:03:16 +0100
committerKirill Bulatov <[email protected]>2021-06-10 21:43:46 +0100
commit3aaf07b8cb9a17669894db9f3e6afdb302676fdb (patch)
tree40887b0852021392418f7369d9c3ec27ab966b62 /crates/hir
parentf4da4de7cdd4a7dfe40a417b0100b83ec50d1e1d (diff)
Add more profiling for flyimports
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index debc3ee62..b9c1dc44d 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -191,6 +191,7 @@ impl Crate {
191 db: &dyn DefDatabase, 191 db: &dyn DefDatabase,
192 query: import_map::Query, 192 query: import_map::Query,
193 ) -> impl Iterator<Item = Either<ModuleDef, MacroDef>> { 193 ) -> impl Iterator<Item = Either<ModuleDef, MacroDef>> {
194 let _p = profile::span("query_external_importables");
194 import_map::search_dependencies(db, self.into(), query).into_iter().map(|item| match item { 195 import_map::search_dependencies(db, self.into(), query).into_iter().map(|item| match item {
195 ItemInNs::Types(mod_id) | ItemInNs::Values(mod_id) => Either::Left(mod_id.into()), 196 ItemInNs::Types(mod_id) | ItemInNs::Values(mod_id) => Either::Left(mod_id.into()),
196 ItemInNs::Macros(mac_id) => Either::Right(mac_id.into()), 197 ItemInNs::Macros(mac_id) => Either::Right(mac_id.into()),
@@ -2185,6 +2186,7 @@ impl Type {
2185 name: Option<&Name>, 2186 name: Option<&Name>,
2186 mut callback: impl FnMut(&Ty, Function) -> Option<T>, 2187 mut callback: impl FnMut(&Ty, Function) -> Option<T>,
2187 ) -> Option<T> { 2188 ) -> Option<T> {
2189 let _p = profile::span("iterate_method_candidates");
2188 // There should be no inference vars in types passed here 2190 // There should be no inference vars in types passed here
2189 // FIXME check that? 2191 // FIXME check that?
2190 // FIXME replace Unknown by bound vars here 2192 // FIXME replace Unknown by bound vars here
@@ -2218,6 +2220,7 @@ impl Type {
2218 name: Option<&Name>, 2220 name: Option<&Name>,
2219 mut callback: impl FnMut(&Ty, AssocItem) -> Option<T>, 2221 mut callback: impl FnMut(&Ty, AssocItem) -> Option<T>,
2220 ) -> Option<T> { 2222 ) -> Option<T> {
2223 let _p = profile::span("iterate_path_candidates");
2221 let canonical = hir_ty::replace_errors_with_variables(&self.ty); 2224 let canonical = hir_ty::replace_errors_with_variables(&self.ty);
2222 2225
2223 let env = self.env.clone(); 2226 let env = self.env.clone();
@@ -2255,6 +2258,7 @@ impl Type {
2255 &'a self, 2258 &'a self,
2256 db: &'a dyn HirDatabase, 2259 db: &'a dyn HirDatabase,
2257 ) -> impl Iterator<Item = Trait> + 'a { 2260 ) -> impl Iterator<Item = Trait> + 'a {
2261 let _p = profile::span("applicable_inherent_traits");
2258 self.autoderef(db) 2262 self.autoderef(db)
2259 .filter_map(|derefed_type| derefed_type.ty.dyn_trait()) 2263 .filter_map(|derefed_type| derefed_type.ty.dyn_trait())
2260 .flat_map(move |dyn_trait_id| hir_ty::all_super_traits(db.upcast(), dyn_trait_id)) 2264 .flat_map(move |dyn_trait_id| hir_ty::all_super_traits(db.upcast(), dyn_trait_id))