diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-08-12 15:36:01 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-12 15:36:01 +0100 |
commit | 147547e7b85e80e2e30aa1a5ba4d9d0969908398 (patch) | |
tree | c39749d1b71b73b4017c2d0d848ebdc85e570c39 /crates | |
parent | 6be5ab02008b442c85c201968b97f24f13c4692e (diff) | |
parent | 208b7bd7ba687fb570feb1b89219f14c63712ce8 (diff) |
Merge #5724
5724: Rename ra_prof -> profile
r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
77 files changed, 162 insertions, 196 deletions
diff --git a/crates/ra_arena/Cargo.toml b/crates/arena/Cargo.toml index 66c3738f4..f2bb5cc45 100644 --- a/crates/ra_arena/Cargo.toml +++ b/crates/arena/Cargo.toml | |||
@@ -1,9 +1,9 @@ | |||
1 | [package] | 1 | [package] |
2 | edition = "2018" | 2 | name = "arena" |
3 | name = "ra_arena" | 3 | version = "0.0.0" |
4 | version = "0.1.0" | ||
5 | authors = ["rust-analyzer developers"] | ||
6 | license = "MIT OR Apache-2.0" | 4 | license = "MIT OR Apache-2.0" |
5 | authors = ["rust-analyzer developers"] | ||
6 | edition = "2018" | ||
7 | 7 | ||
8 | [lib] | 8 | [lib] |
9 | doctest = false | 9 | doctest = false |
diff --git a/crates/ra_arena/src/lib.rs b/crates/arena/src/lib.rs index 3169aa5b8..3169aa5b8 100644 --- a/crates/ra_arena/src/lib.rs +++ b/crates/arena/src/lib.rs | |||
diff --git a/crates/ra_arena/src/map.rs b/crates/arena/src/map.rs index 0f33907c0..0f33907c0 100644 --- a/crates/ra_arena/src/map.rs +++ b/crates/arena/src/map.rs | |||
diff --git a/crates/ra_prof/Cargo.toml b/crates/profile/Cargo.toml index c82b9f76d..e271e3a56 100644 --- a/crates/ra_prof/Cargo.toml +++ b/crates/profile/Cargo.toml | |||
@@ -1,20 +1,20 @@ | |||
1 | [package] | 1 | [package] |
2 | edition = "2018" | 2 | name = "profile" |
3 | name = "ra_prof" | 3 | version = "0.0.0" |
4 | version = "0.1.0" | ||
5 | authors = ["rust-analyzer developers"] | ||
6 | publish = false | ||
7 | license = "MIT OR Apache-2.0" | 4 | license = "MIT OR Apache-2.0" |
5 | authors = ["rust-analyzer developers"] | ||
6 | edition = "2018" | ||
8 | 7 | ||
9 | [lib] | 8 | [lib] |
10 | doctest = false | 9 | doctest = false |
11 | 10 | ||
12 | [dependencies] | 11 | [dependencies] |
13 | ra_arena = { path = "../ra_arena" } | ||
14 | once_cell = "1.3.1" | 12 | once_cell = "1.3.1" |
15 | backtrace = { version = "0.3.44", optional = true } | ||
16 | cfg-if = "0.1.10" | 13 | cfg-if = "0.1.10" |
17 | libc = "0.2.73" | 14 | libc = "0.2.73" |
15 | backtrace = { version = "0.3.44", optional = true } | ||
16 | |||
17 | arena = { path = "../arena" } | ||
18 | 18 | ||
19 | [target.'cfg(target_os = "linux")'.dependencies] | 19 | [target.'cfg(target_os = "linux")'.dependencies] |
20 | perf-event = "0.4" | 20 | perf-event = "0.4" |
diff --git a/crates/ra_prof/src/google_cpu_profiler.rs b/crates/profile/src/google_cpu_profiler.rs index db865c65b..db865c65b 100644 --- a/crates/ra_prof/src/google_cpu_profiler.rs +++ b/crates/profile/src/google_cpu_profiler.rs | |||
diff --git a/crates/ra_prof/src/hprof.rs b/crates/profile/src/hprof.rs index a3f5321fb..934cc8e37 100644 --- a/crates/ra_prof/src/hprof.rs +++ b/crates/profile/src/hprof.rs | |||
@@ -37,19 +37,16 @@ pub type Label = &'static str; | |||
37 | /// | 37 | /// |
38 | /// # Example | 38 | /// # Example |
39 | /// ``` | 39 | /// ``` |
40 | /// use ra_prof::{profile, set_filter, Filter}; | 40 | /// profile::init_from("profile1|profile2@2"); |
41 | /// | ||
42 | /// let f = Filter::from_spec("profile1|profile2@2"); | ||
43 | /// set_filter(f); | ||
44 | /// profiling_function1(); | 41 | /// profiling_function1(); |
45 | /// | 42 | /// |
46 | /// fn profiling_function1() { | 43 | /// fn profiling_function1() { |
47 | /// let _p = profile("profile1"); | 44 | /// let _p = profile::span("profile1"); |
48 | /// profiling_function2(); | 45 | /// profiling_function2(); |
49 | /// } | 46 | /// } |
50 | /// | 47 | /// |
51 | /// fn profiling_function2() { | 48 | /// fn profiling_function2() { |
52 | /// let _p = profile("profile2"); | 49 | /// let _p = profile::span("profile2"); |
53 | /// } | 50 | /// } |
54 | /// ``` | 51 | /// ``` |
55 | /// This will print in the stderr the following: | 52 | /// This will print in the stderr the following: |
@@ -57,27 +54,27 @@ pub type Label = &'static str; | |||
57 | /// 0ms - profile | 54 | /// 0ms - profile |
58 | /// 0ms - profile2 | 55 | /// 0ms - profile2 |
59 | /// ``` | 56 | /// ``` |
60 | pub fn profile(label: Label) -> Profiler { | 57 | pub fn span(label: Label) -> ProfileSpan { |
61 | assert!(!label.is_empty()); | 58 | assert!(!label.is_empty()); |
62 | 59 | ||
63 | if PROFILING_ENABLED.load(Ordering::Relaxed) | 60 | if PROFILING_ENABLED.load(Ordering::Relaxed) |
64 | && PROFILE_STACK.with(|stack| stack.borrow_mut().push(label)) | 61 | && PROFILE_STACK.with(|stack| stack.borrow_mut().push(label)) |
65 | { | 62 | { |
66 | Profiler(Some(ProfilerImpl { label, detail: None })) | 63 | ProfileSpan(Some(ProfilerImpl { label, detail: None })) |
67 | } else { | 64 | } else { |
68 | Profiler(None) | 65 | ProfileSpan(None) |
69 | } | 66 | } |
70 | } | 67 | } |
71 | 68 | ||
72 | pub struct Profiler(Option<ProfilerImpl>); | 69 | pub struct ProfileSpan(Option<ProfilerImpl>); |
73 | 70 | ||
74 | struct ProfilerImpl { | 71 | struct ProfilerImpl { |
75 | label: Label, | 72 | label: Label, |
76 | detail: Option<String>, | 73 | detail: Option<String>, |
77 | } | 74 | } |
78 | 75 | ||
79 | impl Profiler { | 76 | impl ProfileSpan { |
80 | pub fn detail(mut self, detail: impl FnOnce() -> String) -> Profiler { | 77 | pub fn detail(mut self, detail: impl FnOnce() -> String) -> ProfileSpan { |
81 | if let Some(profiler) = &mut self.0 { | 78 | if let Some(profiler) = &mut self.0 { |
82 | profiler.detail = Some(detail()) | 79 | profiler.detail = Some(detail()) |
83 | } | 80 | } |
diff --git a/crates/ra_prof/src/lib.rs b/crates/profile/src/lib.rs index eb50965ae..ab19271c7 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/profile/src/lib.rs | |||
@@ -10,7 +10,7 @@ mod tree; | |||
10 | use std::cell::RefCell; | 10 | use std::cell::RefCell; |
11 | 11 | ||
12 | pub use crate::{ | 12 | pub use crate::{ |
13 | hprof::{init, init_from, profile}, | 13 | hprof::{init, init_from, span}, |
14 | memory_usage::{Bytes, MemoryUsage}, | 14 | memory_usage::{Bytes, MemoryUsage}, |
15 | stop_watch::{StopWatch, StopWatchSpan}, | 15 | stop_watch::{StopWatch, StopWatchSpan}, |
16 | }; | 16 | }; |
@@ -25,7 +25,7 @@ pub fn print_backtrace() { | |||
25 | pub fn print_backtrace() { | 25 | pub fn print_backtrace() { |
26 | eprintln!( | 26 | eprintln!( |
27 | r#"enable the backtrace feature: | 27 | r#"enable the backtrace feature: |
28 | ra_prof = {{ path = "../ra_prof", features = [ "backtrace"] }} | 28 | profile = {{ path = "../profile", features = [ "backtrace"] }} |
29 | "# | 29 | "# |
30 | ); | 30 | ); |
31 | } | 31 | } |
@@ -76,12 +76,12 @@ impl Drop for Scope { | |||
76 | /// | 76 | /// |
77 | /// https://github.com/rust-analyzer/rust-analyzer/pull/5306 | 77 | /// https://github.com/rust-analyzer/rust-analyzer/pull/5306 |
78 | #[derive(Debug)] | 78 | #[derive(Debug)] |
79 | pub struct CpuProfiler { | 79 | pub struct CpuSpan { |
80 | _private: (), | 80 | _private: (), |
81 | } | 81 | } |
82 | 82 | ||
83 | #[must_use] | 83 | #[must_use] |
84 | pub fn cpu_profiler() -> CpuProfiler { | 84 | pub fn cpu_span() -> CpuSpan { |
85 | #[cfg(feature = "cpu_profiler")] | 85 | #[cfg(feature = "cpu_profiler")] |
86 | { | 86 | { |
87 | google_cpu_profiler::start("./out.profile".as_ref()) | 87 | google_cpu_profiler::start("./out.profile".as_ref()) |
@@ -92,10 +92,10 @@ pub fn cpu_profiler() -> CpuProfiler { | |||
92 | eprintln!("cpu_profiler feature is disabled") | 92 | eprintln!("cpu_profiler feature is disabled") |
93 | } | 93 | } |
94 | 94 | ||
95 | CpuProfiler { _private: () } | 95 | CpuSpan { _private: () } |
96 | } | 96 | } |
97 | 97 | ||
98 | impl Drop for CpuProfiler { | 98 | impl Drop for CpuSpan { |
99 | fn drop(&mut self) { | 99 | fn drop(&mut self) { |
100 | #[cfg(feature = "cpu_profiler")] | 100 | #[cfg(feature = "cpu_profiler")] |
101 | { | 101 | { |
diff --git a/crates/ra_prof/src/memory_usage.rs b/crates/profile/src/memory_usage.rs index 83390212a..83390212a 100644 --- a/crates/ra_prof/src/memory_usage.rs +++ b/crates/profile/src/memory_usage.rs | |||
diff --git a/crates/ra_prof/src/stop_watch.rs b/crates/profile/src/stop_watch.rs index 5e276190e..5e276190e 100644 --- a/crates/ra_prof/src/stop_watch.rs +++ b/crates/profile/src/stop_watch.rs | |||
diff --git a/crates/ra_prof/src/tree.rs b/crates/profile/src/tree.rs index 9ea5b5db8..096f58511 100644 --- a/crates/ra_prof/src/tree.rs +++ b/crates/profile/src/tree.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! A simple tree implementation which tries to not allocate all over the place. | 1 | //! A simple tree implementation which tries to not allocate all over the place. |
2 | use std::ops; | 2 | use std::ops; |
3 | 3 | ||
4 | use ra_arena::Arena; | 4 | use arena::Arena; |
5 | 5 | ||
6 | #[derive(Default)] | 6 | #[derive(Default)] |
7 | pub struct Tree<T> { | 7 | pub struct Tree<T> { |
@@ -9,7 +9,7 @@ pub struct Tree<T> { | |||
9 | current_path: Vec<(Idx<T>, Option<Idx<T>>)>, | 9 | current_path: Vec<(Idx<T>, Option<Idx<T>>)>, |
10 | } | 10 | } |
11 | 11 | ||
12 | pub type Idx<T> = ra_arena::Idx<Node<T>>; | 12 | pub type Idx<T> = arena::Idx<Node<T>>; |
13 | 13 | ||
14 | impl<T> Tree<T> { | 14 | impl<T> Tree<T> { |
15 | pub fn start(&mut self) | 15 | pub fn start(&mut self) |
diff --git a/crates/ra_assists/Cargo.toml b/crates/ra_assists/Cargo.toml index bd2905f08..6f5ace941 100644 --- a/crates/ra_assists/Cargo.toml +++ b/crates/ra_assists/Cargo.toml | |||
@@ -18,7 +18,7 @@ stdx = { path = "../stdx" } | |||
18 | ra_syntax = { path = "../ra_syntax" } | 18 | ra_syntax = { path = "../ra_syntax" } |
19 | ra_text_edit = { path = "../ra_text_edit" } | 19 | ra_text_edit = { path = "../ra_text_edit" } |
20 | ra_fmt = { path = "../ra_fmt" } | 20 | ra_fmt = { path = "../ra_fmt" } |
21 | ra_prof = { path = "../ra_prof" } | 21 | profile = { path = "../profile" } |
22 | ra_db = { path = "../ra_db" } | 22 | ra_db = { path = "../ra_db" } |
23 | ra_ide_db = { path = "../ra_ide_db" } | 23 | ra_ide_db = { path = "../ra_ide_db" } |
24 | hir = { path = "../ra_hir", package = "ra_hir" } | 24 | hir = { path = "../ra_hir", package = "ra_hir" } |
diff --git a/crates/ra_assists/src/handlers/add_missing_impl_members.rs b/crates/ra_assists/src/handlers/add_missing_impl_members.rs index 95a750aee..dd1406228 100644 --- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs +++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs | |||
@@ -110,7 +110,7 @@ fn add_missing_impl_members_inner( | |||
110 | assist_id: &'static str, | 110 | assist_id: &'static str, |
111 | label: &'static str, | 111 | label: &'static str, |
112 | ) -> Option<()> { | 112 | ) -> Option<()> { |
113 | let _p = ra_prof::profile("add_missing_impl_members_inner"); | 113 | let _p = profile::span("add_missing_impl_members_inner"); |
114 | let impl_def = ctx.find_node_at_offset::<ast::Impl>()?; | 114 | let impl_def = ctx.find_node_at_offset::<ast::Impl>()?; |
115 | let impl_item_list = impl_def.assoc_item_list()?; | 115 | let impl_item_list = impl_def.assoc_item_list()?; |
116 | 116 | ||
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index 01e7b7a44..6ec59ec4d 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs | |||
@@ -6,7 +6,6 @@ use hir::{ | |||
6 | Type, | 6 | Type, |
7 | }; | 7 | }; |
8 | use ra_ide_db::{imports_locator, RootDatabase}; | 8 | use ra_ide_db::{imports_locator, RootDatabase}; |
9 | use ra_prof::profile; | ||
10 | use ra_syntax::{ | 9 | use ra_syntax::{ |
11 | ast::{self, AstNode}, | 10 | ast::{self, AstNode}, |
12 | SyntaxNode, | 11 | SyntaxNode, |
@@ -130,7 +129,7 @@ impl AutoImportAssets { | |||
130 | } | 129 | } |
131 | 130 | ||
132 | fn search_for_imports(&self, ctx: &AssistContext) -> BTreeSet<ModPath> { | 131 | fn search_for_imports(&self, ctx: &AssistContext) -> BTreeSet<ModPath> { |
133 | let _p = profile("auto_import::search_for_imports"); | 132 | let _p = profile::span("auto_import::search_for_imports"); |
134 | let db = ctx.db(); | 133 | let db = ctx.db(); |
135 | let current_crate = self.module_with_name_to_import.krate(); | 134 | let current_crate = self.module_with_name_to_import.krate(); |
136 | imports_locator::find_imports(&ctx.sema, current_crate, &self.get_search_query()) | 135 | imports_locator::find_imports(&ctx.sema, current_crate, &self.get_search_query()) |
diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml index fe73dc015..9cb9ba11c 100644 --- a/crates/ra_db/Cargo.toml +++ b/crates/ra_db/Cargo.toml | |||
@@ -14,7 +14,7 @@ rustc-hash = "1.1.0" | |||
14 | 14 | ||
15 | ra_syntax = { path = "../ra_syntax" } | 15 | ra_syntax = { path = "../ra_syntax" } |
16 | ra_cfg = { path = "../ra_cfg" } | 16 | ra_cfg = { path = "../ra_cfg" } |
17 | ra_prof = { path = "../ra_prof" } | 17 | profile = { path = "../profile" } |
18 | ra_tt = { path = "../ra_tt" } | 18 | ra_tt = { path = "../ra_tt" } |
19 | test_utils = { path = "../test_utils" } | 19 | test_utils = { path = "../test_utils" } |
20 | vfs = { path = "../vfs" } | 20 | vfs = { path = "../vfs" } |
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index f25be24fe..795d7d2b6 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs | |||
@@ -5,7 +5,6 @@ pub mod fixture; | |||
5 | 5 | ||
6 | use std::{panic, sync::Arc}; | 6 | use std::{panic, sync::Arc}; |
7 | 7 | ||
8 | use ra_prof::profile; | ||
9 | use ra_syntax::{ast, Parse, SourceFile, TextRange, TextSize}; | 8 | use ra_syntax::{ast, Parse, SourceFile, TextRange, TextSize}; |
10 | use rustc_hash::FxHashSet; | 9 | use rustc_hash::FxHashSet; |
11 | 10 | ||
@@ -113,7 +112,7 @@ pub trait SourceDatabase: CheckCanceled + FileLoader + std::fmt::Debug { | |||
113 | } | 112 | } |
114 | 113 | ||
115 | fn parse_query(db: &dyn SourceDatabase, file_id: FileId) -> Parse<ast::SourceFile> { | 114 | fn parse_query(db: &dyn SourceDatabase, file_id: FileId) -> Parse<ast::SourceFile> { |
116 | let _p = profile("parse_query").detail(|| format!("{:?}", file_id)); | 115 | let _p = profile::span("parse_query").detail(|| format!("{:?}", file_id)); |
117 | let text = db.file_text(file_id); | 116 | let text = db.file_text(file_id); |
118 | SourceFile::parse(&*text) | 117 | SourceFile::parse(&*text) |
119 | } | 118 | } |
diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml index c260bb193..903406e84 100644 --- a/crates/ra_hir/Cargo.toml +++ b/crates/ra_hir/Cargo.toml | |||
@@ -19,7 +19,7 @@ itertools = "0.9.0" | |||
19 | stdx = { path = "../stdx" } | 19 | stdx = { path = "../stdx" } |
20 | ra_syntax = { path = "../ra_syntax" } | 20 | ra_syntax = { path = "../ra_syntax" } |
21 | ra_db = { path = "../ra_db" } | 21 | ra_db = { path = "../ra_db" } |
22 | ra_prof = { path = "../ra_prof" } | 22 | profile = { path = "../profile" } |
23 | hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } | 23 | hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } |
24 | hir_def = { path = "../ra_hir_def", package = "ra_hir_def" } | 24 | hir_def = { path = "../ra_hir_def", package = "ra_hir_def" } |
25 | hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" } | 25 | hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" } |
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 0007d7fa8..5c0c6184a 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -31,7 +31,6 @@ use hir_ty::{ | |||
31 | InEnvironment, Substs, TraitEnvironment, Ty, TyDefId, TypeCtor, | 31 | InEnvironment, Substs, TraitEnvironment, Ty, TyDefId, TypeCtor, |
32 | }; | 32 | }; |
33 | use ra_db::{CrateId, Edition, FileId}; | 33 | use ra_db::{CrateId, Edition, FileId}; |
34 | use ra_prof::profile; | ||
35 | use ra_syntax::{ | 34 | use ra_syntax::{ |
36 | ast::{self, AttrsOwner, NameOwner}, | 35 | ast::{self, AttrsOwner, NameOwner}, |
37 | AstNode, | 36 | AstNode, |
@@ -304,7 +303,7 @@ impl Module { | |||
304 | } | 303 | } |
305 | 304 | ||
306 | pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) { | 305 | pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) { |
307 | let _p = profile("Module::diagnostics"); | 306 | let _p = profile::span("Module::diagnostics"); |
308 | let crate_def_map = db.crate_def_map(self.id.krate); | 307 | let crate_def_map = db.crate_def_map(self.id.krate); |
309 | crate_def_map.add_diagnostics(db.upcast(), self.id.local_id, sink); | 308 | crate_def_map.add_diagnostics(db.upcast(), self.id.local_id, sink); |
310 | for decl in self.declarations(db) { | 309 | for decl in self.declarations(db) { |
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index 36b688ccb..7e3ec6315 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs | |||
@@ -12,7 +12,6 @@ use hir_expand::{hygiene::Hygiene, name::AsName, ExpansionInfo}; | |||
12 | use hir_ty::associated_type_shorthand_candidates; | 12 | use hir_ty::associated_type_shorthand_candidates; |
13 | use itertools::Itertools; | 13 | use itertools::Itertools; |
14 | use ra_db::{FileId, FileRange}; | 14 | use ra_db::{FileId, FileRange}; |
15 | use ra_prof::profile; | ||
16 | use ra_syntax::{ | 15 | use ra_syntax::{ |
17 | algo::{find_node_at_offset, skip_trivia_token}, | 16 | algo::{find_node_at_offset, skip_trivia_token}, |
18 | ast, AstNode, Direction, SyntaxNode, SyntaxToken, TextRange, TextSize, | 17 | ast, AstNode, Direction, SyntaxNode, SyntaxToken, TextRange, TextSize, |
@@ -334,7 +333,7 @@ impl<'db> SemanticsImpl<'db> { | |||
334 | } | 333 | } |
335 | 334 | ||
336 | fn descend_into_macros(&self, token: SyntaxToken) -> SyntaxToken { | 335 | fn descend_into_macros(&self, token: SyntaxToken) -> SyntaxToken { |
337 | let _p = profile("descend_into_macros"); | 336 | let _p = profile::span("descend_into_macros"); |
338 | let parent = token.parent(); | 337 | let parent = token.parent(); |
339 | let parent = self.find_file(parent); | 338 | let parent = self.find_file(parent); |
340 | let sa = self.analyze2(parent.as_ref(), None); | 339 | let sa = self.analyze2(parent.as_ref(), None); |
@@ -523,7 +522,7 @@ impl<'db> SemanticsImpl<'db> { | |||
523 | } | 522 | } |
524 | 523 | ||
525 | fn analyze2(&self, src: InFile<&SyntaxNode>, offset: Option<TextSize>) -> SourceAnalyzer { | 524 | fn analyze2(&self, src: InFile<&SyntaxNode>, offset: Option<TextSize>) -> SourceAnalyzer { |
526 | let _p = profile("Semantics::analyze2"); | 525 | let _p = profile::span("Semantics::analyze2"); |
527 | 526 | ||
528 | let container = match self.with_ctx(|ctx| ctx.find_container(src)) { | 527 | let container = match self.with_ctx(|ctx| ctx.find_container(src)) { |
529 | Some(it) => it, | 528 | Some(it) => it, |
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs index 863e8e5ff..a6ff8b0bf 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs | |||
@@ -10,7 +10,6 @@ use hir_def::{ | |||
10 | }; | 10 | }; |
11 | use hir_expand::{name::AsName, AstId, MacroDefKind}; | 11 | use hir_expand::{name::AsName, AstId, MacroDefKind}; |
12 | use ra_db::FileId; | 12 | use ra_db::FileId; |
13 | use ra_prof::profile; | ||
14 | use ra_syntax::{ | 13 | use ra_syntax::{ |
15 | ast::{self, NameOwner}, | 14 | ast::{self, NameOwner}, |
16 | match_ast, AstNode, SyntaxNode, | 15 | match_ast, AstNode, SyntaxNode, |
@@ -29,7 +28,7 @@ pub(super) struct SourceToDefCtx<'a, 'b> { | |||
29 | 28 | ||
30 | impl SourceToDefCtx<'_, '_> { | 29 | impl SourceToDefCtx<'_, '_> { |
31 | pub(super) fn file_to_def(&mut self, file: FileId) -> Option<ModuleId> { | 30 | pub(super) fn file_to_def(&mut self, file: FileId) -> Option<ModuleId> { |
32 | let _p = profile("SourceBinder::to_module_def"); | 31 | let _p = profile::span("SourceBinder::to_module_def"); |
33 | let (krate, local_id) = self.db.relevant_crates(file).iter().find_map(|&crate_id| { | 32 | let (krate, local_id) = self.db.relevant_crates(file).iter().find_map(|&crate_id| { |
34 | let crate_def_map = self.db.crate_def_map(crate_id); | 33 | let crate_def_map = self.db.crate_def_map(crate_id); |
35 | let local_id = crate_def_map.modules_for_file(file).next()?; | 34 | let local_id = crate_def_map.modules_for_file(file).next()?; |
@@ -39,7 +38,7 @@ impl SourceToDefCtx<'_, '_> { | |||
39 | } | 38 | } |
40 | 39 | ||
41 | pub(super) fn module_to_def(&mut self, src: InFile<ast::Module>) -> Option<ModuleId> { | 40 | pub(super) fn module_to_def(&mut self, src: InFile<ast::Module>) -> Option<ModuleId> { |
42 | let _p = profile("module_to_def"); | 41 | let _p = profile::span("module_to_def"); |
43 | let parent_declaration = src | 42 | let parent_declaration = src |
44 | .as_ref() | 43 | .as_ref() |
45 | .map(|it| it.syntax()) | 44 | .map(|it| it.syntax()) |
diff --git a/crates/ra_hir_def/Cargo.toml b/crates/ra_hir_def/Cargo.toml index d96a86b80..adfd8c7b7 100644 --- a/crates/ra_hir_def/Cargo.toml +++ b/crates/ra_hir_def/Cargo.toml | |||
@@ -22,10 +22,10 @@ smallvec = "1.4.0" | |||
22 | 22 | ||
23 | stdx = { path = "../stdx" } | 23 | stdx = { path = "../stdx" } |
24 | 24 | ||
25 | ra_arena = { path = "../ra_arena" } | 25 | arena = { path = "../arena" } |
26 | ra_db = { path = "../ra_db" } | 26 | ra_db = { path = "../ra_db" } |
27 | ra_syntax = { path = "../ra_syntax" } | 27 | ra_syntax = { path = "../ra_syntax" } |
28 | ra_prof = { path = "../ra_prof" } | 28 | profile = { path = "../profile" } |
29 | hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } | 29 | hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } |
30 | test_utils = { path = "../test_utils" } | 30 | test_utils = { path = "../test_utils" } |
31 | mbe = { path = "../ra_mbe", package = "ra_mbe" } | 31 | mbe = { path = "../ra_mbe", package = "ra_mbe" } |
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index 35c3a9140..896a69ca8 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs | |||
@@ -2,12 +2,12 @@ | |||
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use arena::{map::ArenaMap, Arena}; | ||
5 | use either::Either; | 6 | use either::Either; |
6 | use hir_expand::{ | 7 | use hir_expand::{ |
7 | name::{AsName, Name}, | 8 | name::{AsName, Name}, |
8 | InFile, | 9 | InFile, |
9 | }; | 10 | }; |
10 | use ra_arena::{map::ArenaMap, Arena}; | ||
11 | use ra_syntax::ast::{self, NameOwner, VisibilityOwner}; | 11 | use ra_syntax::ast::{self, NameOwner, VisibilityOwner}; |
12 | use tt::{Delimiter, DelimiterKind, Leaf, Subtree, TokenTree}; | 12 | use tt::{Delimiter, DelimiterKind, Leaf, Subtree, TokenTree}; |
13 | 13 | ||
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index d5f18b920..1deb1a837 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs | |||
@@ -5,13 +5,12 @@ pub mod scope; | |||
5 | 5 | ||
6 | use std::{mem, ops::Index, sync::Arc}; | 6 | use std::{mem, ops::Index, sync::Arc}; |
7 | 7 | ||
8 | use arena::{map::ArenaMap, Arena}; | ||
8 | use drop_bomb::DropBomb; | 9 | use drop_bomb::DropBomb; |
9 | use either::Either; | 10 | use either::Either; |
10 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId}; | 11 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId}; |
11 | use ra_arena::{map::ArenaMap, Arena}; | ||
12 | use ra_cfg::CfgOptions; | 12 | use ra_cfg::CfgOptions; |
13 | use ra_db::CrateId; | 13 | use ra_db::CrateId; |
14 | use ra_prof::profile; | ||
15 | use ra_syntax::{ast, AstNode, AstPtr}; | 14 | use ra_syntax::{ast, AstNode, AstPtr}; |
16 | use rustc_hash::FxHashMap; | 15 | use rustc_hash::FxHashMap; |
17 | use test_utils::mark; | 16 | use test_utils::mark; |
@@ -228,7 +227,7 @@ impl Body { | |||
228 | db: &dyn DefDatabase, | 227 | db: &dyn DefDatabase, |
229 | def: DefWithBodyId, | 228 | def: DefWithBodyId, |
230 | ) -> (Arc<Body>, Arc<BodySourceMap>) { | 229 | ) -> (Arc<Body>, Arc<BodySourceMap>) { |
231 | let _p = profile("body_with_source_map_query"); | 230 | let _p = profile::span("body_with_source_map_query"); |
232 | let mut params = None; | 231 | let mut params = None; |
233 | 232 | ||
234 | let (file_id, module, body) = match def { | 233 | let (file_id, module, body) = match def { |
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index f5c37edb3..482393006 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -3,13 +3,13 @@ | |||
3 | 3 | ||
4 | use std::{any::type_name, sync::Arc}; | 4 | use std::{any::type_name, sync::Arc}; |
5 | 5 | ||
6 | use arena::Arena; | ||
6 | use either::Either; | 7 | use either::Either; |
7 | use hir_expand::{ | 8 | use hir_expand::{ |
8 | hygiene::Hygiene, | 9 | hygiene::Hygiene, |
9 | name::{name, AsName, Name}, | 10 | name::{name, AsName, Name}, |
10 | HirFileId, MacroDefId, MacroDefKind, | 11 | HirFileId, MacroDefId, MacroDefKind, |
11 | }; | 12 | }; |
12 | use ra_arena::Arena; | ||
13 | use ra_syntax::{ | 13 | use ra_syntax::{ |
14 | ast::{ | 14 | ast::{ |
15 | self, ArgListOwner, ArrayExprKind, AstChildren, LiteralKind, LoopBodyOwner, NameOwner, | 15 | self, ArgListOwner, ArrayExprKind, AstChildren, LiteralKind, LoopBodyOwner, NameOwner, |
diff --git a/crates/ra_hir_def/src/body/scope.rs b/crates/ra_hir_def/src/body/scope.rs index 99e876683..f783e18b5 100644 --- a/crates/ra_hir_def/src/body/scope.rs +++ b/crates/ra_hir_def/src/body/scope.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | //! Name resolution for expressions. | 1 | //! Name resolution for expressions. |
2 | use std::sync::Arc; | 2 | use std::sync::Arc; |
3 | 3 | ||
4 | use arena::{Arena, Idx}; | ||
4 | use hir_expand::name::Name; | 5 | use hir_expand::name::Name; |
5 | use ra_arena::{Arena, Idx}; | ||
6 | use rustc_hash::FxHashMap; | 6 | use rustc_hash::FxHashMap; |
7 | 7 | ||
8 | use crate::{ | 8 | use crate::{ |
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index 88a8ef9bf..758c12f33 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs | |||
@@ -3,7 +3,6 @@ | |||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use hir_expand::{name::Name, InFile}; | 5 | use hir_expand::{name::Name, InFile}; |
6 | use ra_prof::profile; | ||
7 | use ra_syntax::ast; | 6 | use ra_syntax::ast; |
8 | 7 | ||
9 | use crate::{ | 8 | use crate::{ |
@@ -133,7 +132,7 @@ pub struct ImplData { | |||
133 | 132 | ||
134 | impl ImplData { | 133 | impl ImplData { |
135 | pub(crate) fn impl_data_query(db: &dyn DefDatabase, id: ImplId) -> Arc<ImplData> { | 134 | pub(crate) fn impl_data_query(db: &dyn DefDatabase, id: ImplId) -> Arc<ImplData> { |
136 | let _p = profile("impl_data_query"); | 135 | let _p = profile::span("impl_data_query"); |
137 | let impl_loc = id.lookup(db); | 136 | let impl_loc = id.lookup(db); |
138 | 137 | ||
139 | let item_tree = db.item_tree(impl_loc.id.file_id); | 138 | let item_tree = db.item_tree(impl_loc.id.file_id); |
diff --git a/crates/ra_hir_def/src/db.rs b/crates/ra_hir_def/src/db.rs index 9c3ede2d7..1dd4197f8 100644 --- a/crates/ra_hir_def/src/db.rs +++ b/crates/ra_hir_def/src/db.rs | |||
@@ -3,7 +3,6 @@ use std::sync::Arc; | |||
3 | 3 | ||
4 | use hir_expand::{db::AstDatabase, HirFileId}; | 4 | use hir_expand::{db::AstDatabase, HirFileId}; |
5 | use ra_db::{salsa, CrateId, SourceDatabase, Upcast}; | 5 | use ra_db::{salsa, CrateId, SourceDatabase, Upcast}; |
6 | use ra_prof::profile; | ||
7 | use ra_syntax::SmolStr; | 6 | use ra_syntax::SmolStr; |
8 | 7 | ||
9 | use crate::{ | 8 | use crate::{ |
@@ -116,6 +115,6 @@ pub trait DefDatabase: InternDatabase + AstDatabase + Upcast<dyn AstDatabase> { | |||
116 | } | 115 | } |
117 | 116 | ||
118 | fn crate_def_map_wait(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> { | 117 | fn crate_def_map_wait(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> { |
119 | let _p = profile("crate_def_map:wait"); | 118 | let _p = profile::span("crate_def_map:wait"); |
120 | db.crate_def_map_query(krate) | 119 | db.crate_def_map_query(krate) |
121 | } | 120 | } |
diff --git a/crates/ra_hir_def/src/expr.rs b/crates/ra_hir_def/src/expr.rs index e41cfc16b..befe41c2a 100644 --- a/crates/ra_hir_def/src/expr.rs +++ b/crates/ra_hir_def/src/expr.rs | |||
@@ -12,8 +12,8 @@ | |||
12 | //! | 12 | //! |
13 | //! See also a neighboring `body` module. | 13 | //! See also a neighboring `body` module. |
14 | 14 | ||
15 | use arena::{Idx, RawId}; | ||
15 | use hir_expand::name::Name; | 16 | use hir_expand::name::Name; |
16 | use ra_arena::{Idx, RawId}; | ||
17 | use ra_syntax::ast::RangeOp; | 17 | use ra_syntax::ast::RangeOp; |
18 | 18 | ||
19 | use crate::{ | 19 | use crate::{ |
diff --git a/crates/ra_hir_def/src/find_path.rs b/crates/ra_hir_def/src/find_path.rs index 06701a830..46e70eb48 100644 --- a/crates/ra_hir_def/src/find_path.rs +++ b/crates/ra_hir_def/src/find_path.rs | |||
@@ -1,7 +1,6 @@ | |||
1 | //! An algorithm to find a path to refer to a certain item. | 1 | //! An algorithm to find a path to refer to a certain item. |
2 | 2 | ||
3 | use hir_expand::name::{known, AsName, Name}; | 3 | use hir_expand::name::{known, AsName, Name}; |
4 | use ra_prof::profile; | ||
5 | use rustc_hash::FxHashSet; | 4 | use rustc_hash::FxHashSet; |
6 | use test_utils::mark; | 5 | use test_utils::mark; |
7 | 6 | ||
@@ -18,7 +17,7 @@ use crate::{ | |||
18 | /// Find a path that can be used to refer to a certain item. This can depend on | 17 | /// Find a path that can be used to refer to a certain item. This can depend on |
19 | /// *from where* you're referring to the item, hence the `from` parameter. | 18 | /// *from where* you're referring to the item, hence the `from` parameter. |
20 | pub fn find_path(db: &dyn DefDatabase, item: ItemInNs, from: ModuleId) -> Option<ModPath> { | 19 | pub fn find_path(db: &dyn DefDatabase, item: ItemInNs, from: ModuleId) -> Option<ModPath> { |
21 | let _p = profile("find_path"); | 20 | let _p = profile::span("find_path"); |
22 | find_path_inner(db, item, from, MAX_PATH_LEN) | 21 | find_path_inner(db, item, from, MAX_PATH_LEN) |
23 | } | 22 | } |
24 | 23 | ||
@@ -215,7 +214,7 @@ fn find_local_import_locations( | |||
215 | item: ItemInNs, | 214 | item: ItemInNs, |
216 | from: ModuleId, | 215 | from: ModuleId, |
217 | ) -> Vec<(ModuleId, Name)> { | 216 | ) -> Vec<(ModuleId, Name)> { |
218 | let _p = profile("find_local_import_locations"); | 217 | let _p = profile::span("find_local_import_locations"); |
219 | 218 | ||
220 | // `from` can import anything below `from` with visibility of at least `from`, and anything | 219 | // `from` can import anything below `from` with visibility of at least `from`, and anything |
221 | // above `from` with any visibility. That means we do not need to descend into private siblings | 220 | // above `from` with any visibility. That means we do not need to descend into private siblings |
diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs index 699ba9c92..0e06a0b12 100644 --- a/crates/ra_hir_def/src/generics.rs +++ b/crates/ra_hir_def/src/generics.rs | |||
@@ -4,14 +4,13 @@ | |||
4 | //! in rustc. | 4 | //! in rustc. |
5 | use std::sync::Arc; | 5 | use std::sync::Arc; |
6 | 6 | ||
7 | use arena::{map::ArenaMap, Arena}; | ||
7 | use either::Either; | 8 | use either::Either; |
8 | use hir_expand::{ | 9 | use hir_expand::{ |
9 | name::{name, AsName, Name}, | 10 | name::{name, AsName, Name}, |
10 | InFile, | 11 | InFile, |
11 | }; | 12 | }; |
12 | use ra_arena::{map::ArenaMap, Arena}; | ||
13 | use ra_db::FileId; | 13 | use ra_db::FileId; |
14 | use ra_prof::profile; | ||
15 | use ra_syntax::ast::{self, GenericParamsOwner, NameOwner, TypeBoundsOwner}; | 14 | use ra_syntax::ast::{self, GenericParamsOwner, NameOwner, TypeBoundsOwner}; |
16 | 15 | ||
17 | use crate::{ | 16 | use crate::{ |
@@ -73,7 +72,7 @@ impl GenericParams { | |||
73 | db: &dyn DefDatabase, | 72 | db: &dyn DefDatabase, |
74 | def: GenericDefId, | 73 | def: GenericDefId, |
75 | ) -> Arc<GenericParams> { | 74 | ) -> Arc<GenericParams> { |
76 | let _p = profile("generic_params_query"); | 75 | let _p = profile::span("generic_params_query"); |
77 | 76 | ||
78 | let generics = match def { | 77 | let generics = match def { |
79 | GenericDefId::FunctionId(id) => { | 78 | GenericDefId::FunctionId(id) => { |
diff --git a/crates/ra_hir_def/src/import_map.rs b/crates/ra_hir_def/src/import_map.rs index 9e4c30b1a..3a9eec887 100644 --- a/crates/ra_hir_def/src/import_map.rs +++ b/crates/ra_hir_def/src/import_map.rs | |||
@@ -56,7 +56,7 @@ pub struct ImportMap { | |||
56 | 56 | ||
57 | impl ImportMap { | 57 | impl ImportMap { |
58 | pub fn import_map_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<Self> { | 58 | pub fn import_map_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<Self> { |
59 | let _p = ra_prof::profile("import_map_query"); | 59 | let _p = profile::span("import_map_query"); |
60 | let def_map = db.crate_def_map(krate); | 60 | let def_map = db.crate_def_map(krate); |
61 | let mut import_map = Self::default(); | 61 | let mut import_map = Self::default(); |
62 | 62 | ||
@@ -254,7 +254,7 @@ pub fn search_dependencies<'a>( | |||
254 | krate: CrateId, | 254 | krate: CrateId, |
255 | query: Query, | 255 | query: Query, |
256 | ) -> Vec<ItemInNs> { | 256 | ) -> Vec<ItemInNs> { |
257 | let _p = ra_prof::profile("search_dependencies").detail(|| format!("{:?}", query)); | 257 | let _p = profile::span("search_dependencies").detail(|| format!("{:?}", query)); |
258 | 258 | ||
259 | let graph = db.crate_graph(); | 259 | let graph = db.crate_graph(); |
260 | let import_maps: Vec<_> = | 260 | let import_maps: Vec<_> = |
diff --git a/crates/ra_hir_def/src/item_tree.rs b/crates/ra_hir_def/src/item_tree.rs index a67e75dac..104966c7f 100644 --- a/crates/ra_hir_def/src/item_tree.rs +++ b/crates/ra_hir_def/src/item_tree.rs | |||
@@ -13,6 +13,7 @@ use std::{ | |||
13 | sync::Arc, | 13 | sync::Arc, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | use arena::{Arena, Idx, RawId}; | ||
16 | use ast::{AstNode, AttrsOwner, NameOwner, StructKind}; | 17 | use ast::{AstNode, AttrsOwner, NameOwner, StructKind}; |
17 | use either::Either; | 18 | use either::Either; |
18 | use hir_expand::{ | 19 | use hir_expand::{ |
@@ -21,7 +22,6 @@ use hir_expand::{ | |||
21 | name::{name, AsName, Name}, | 22 | name::{name, AsName, Name}, |
22 | HirFileId, InFile, | 23 | HirFileId, InFile, |
23 | }; | 24 | }; |
24 | use ra_arena::{Arena, Idx, RawId}; | ||
25 | use ra_syntax::{ast, match_ast}; | 25 | use ra_syntax::{ast, match_ast}; |
26 | use rustc_hash::FxHashMap; | 26 | use rustc_hash::FxHashMap; |
27 | use smallvec::SmallVec; | 27 | use smallvec::SmallVec; |
@@ -77,7 +77,7 @@ pub struct ItemTree { | |||
77 | 77 | ||
78 | impl ItemTree { | 78 | impl ItemTree { |
79 | pub fn item_tree_query(db: &dyn DefDatabase, file_id: HirFileId) -> Arc<ItemTree> { | 79 | pub fn item_tree_query(db: &dyn DefDatabase, file_id: HirFileId) -> Arc<ItemTree> { |
80 | let _p = ra_prof::profile("item_tree_query").detail(|| format!("{:?}", file_id)); | 80 | let _p = profile::span("item_tree_query").detail(|| format!("{:?}", file_id)); |
81 | let syntax = if let Some(node) = db.parse_or_expand(file_id) { | 81 | let syntax = if let Some(node) = db.parse_or_expand(file_id) { |
82 | node | 82 | node |
83 | } else { | 83 | } else { |
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 450ef8798..4523d0fbb 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | use std::{collections::hash_map::Entry, mem, sync::Arc}; | 3 | use std::{collections::hash_map::Entry, mem, sync::Arc}; |
4 | 4 | ||
5 | use arena::map::ArenaMap; | ||
5 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId}; | 6 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId}; |
6 | use ra_arena::map::ArenaMap; | ||
7 | use ra_syntax::{ | 7 | use ra_syntax::{ |
8 | ast::{self, ModuleItemOwner}, | 8 | ast::{self, ModuleItemOwner}, |
9 | SyntaxNode, | 9 | SyntaxNode, |
diff --git a/crates/ra_hir_def/src/lang_item.rs b/crates/ra_hir_def/src/lang_item.rs index 3516784b8..3631499bf 100644 --- a/crates/ra_hir_def/src/lang_item.rs +++ b/crates/ra_hir_def/src/lang_item.rs | |||
@@ -4,7 +4,6 @@ | |||
4 | //! features, such as Fn family of traits. | 4 | //! features, such as Fn family of traits. |
5 | use std::sync::Arc; | 5 | use std::sync::Arc; |
6 | 6 | ||
7 | use ra_prof::profile; | ||
8 | use ra_syntax::SmolStr; | 7 | use ra_syntax::SmolStr; |
9 | use rustc_hash::FxHashMap; | 8 | use rustc_hash::FxHashMap; |
10 | 9 | ||
@@ -79,7 +78,7 @@ impl LangItems { | |||
79 | 78 | ||
80 | /// Salsa query. This will look for lang items in a specific crate. | 79 | /// Salsa query. This will look for lang items in a specific crate. |
81 | pub(crate) fn crate_lang_items_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<LangItems> { | 80 | pub(crate) fn crate_lang_items_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<LangItems> { |
82 | let _p = profile("crate_lang_items_query"); | 81 | let _p = profile::span("crate_lang_items_query"); |
83 | 82 | ||
84 | let mut lang_items = LangItems::default(); | 83 | let mut lang_items = LangItems::default(); |
85 | 84 | ||
@@ -98,7 +97,7 @@ impl LangItems { | |||
98 | db: &dyn DefDatabase, | 97 | db: &dyn DefDatabase, |
99 | module: ModuleId, | 98 | module: ModuleId, |
100 | ) -> Option<Arc<LangItems>> { | 99 | ) -> Option<Arc<LangItems>> { |
101 | let _p = profile("module_lang_items_query"); | 100 | let _p = profile::span("module_lang_items_query"); |
102 | let mut lang_items = LangItems::default(); | 101 | let mut lang_items = LangItems::default(); |
103 | lang_items.collect_lang_items(db, module); | 102 | lang_items.collect_lang_items(db, module); |
104 | if lang_items.items.is_empty() { | 103 | if lang_items.items.is_empty() { |
@@ -115,7 +114,7 @@ impl LangItems { | |||
115 | start_crate: CrateId, | 114 | start_crate: CrateId, |
116 | item: SmolStr, | 115 | item: SmolStr, |
117 | ) -> Option<LangItemTarget> { | 116 | ) -> Option<LangItemTarget> { |
118 | let _p = profile("lang_item_query"); | 117 | let _p = profile::span("lang_item_query"); |
119 | let lang_items = db.crate_lang_items(start_crate); | 118 | let lang_items = db.crate_lang_items(start_crate); |
120 | let start_crate_target = lang_items.items.get(&item); | 119 | let start_crate_target = lang_items.items.get(&item); |
121 | if let Some(target) = start_crate_target { | 120 | if let Some(target) = start_crate_target { |
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 237b1038a..810393739 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs | |||
@@ -52,11 +52,11 @@ mod test_db; | |||
52 | 52 | ||
53 | use std::hash::{Hash, Hasher}; | 53 | use std::hash::{Hash, Hasher}; |
54 | 54 | ||
55 | use arena::Idx; | ||
55 | use hir_expand::{ | 56 | use hir_expand::{ |
56 | ast_id_map::FileAstId, eager::expand_eager_macro, hygiene::Hygiene, AstId, HirFileId, InFile, | 57 | ast_id_map::FileAstId, eager::expand_eager_macro, hygiene::Hygiene, AstId, HirFileId, InFile, |
57 | MacroCallId, MacroCallKind, MacroDefId, MacroDefKind, | 58 | MacroCallId, MacroCallKind, MacroDefId, MacroDefKind, |
58 | }; | 59 | }; |
59 | use ra_arena::Idx; | ||
60 | use ra_db::{impl_intern_key, salsa, CrateId}; | 60 | use ra_db::{impl_intern_key, salsa, CrateId}; |
61 | use ra_syntax::ast; | 61 | use ra_syntax::ast; |
62 | 62 | ||
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs index 3d9b55a73..dc239997f 100644 --- a/crates/ra_hir_def/src/nameres.rs +++ b/crates/ra_hir_def/src/nameres.rs | |||
@@ -56,10 +56,9 @@ mod tests; | |||
56 | 56 | ||
57 | use std::sync::Arc; | 57 | use std::sync::Arc; |
58 | 58 | ||
59 | use arena::Arena; | ||
59 | use hir_expand::{diagnostics::DiagnosticSink, name::Name, InFile}; | 60 | use hir_expand::{diagnostics::DiagnosticSink, name::Name, InFile}; |
60 | use ra_arena::Arena; | ||
61 | use ra_db::{CrateId, Edition, FileId}; | 61 | use ra_db::{CrateId, Edition, FileId}; |
62 | use ra_prof::profile; | ||
63 | use ra_syntax::ast; | 62 | use ra_syntax::ast; |
64 | use rustc_hash::FxHashMap; | 63 | use rustc_hash::FxHashMap; |
65 | use stdx::format_to; | 64 | use stdx::format_to; |
@@ -172,7 +171,7 @@ pub struct ModuleData { | |||
172 | 171 | ||
173 | impl CrateDefMap { | 172 | impl CrateDefMap { |
174 | pub(crate) fn crate_def_map_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<CrateDefMap> { | 173 | pub(crate) fn crate_def_map_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<CrateDefMap> { |
175 | let _p = profile("crate_def_map_query").detail(|| { | 174 | let _p = profile::span("crate_def_map_query").detail(|| { |
176 | db.crate_graph()[krate] | 175 | db.crate_graph()[krate] |
177 | .display_name | 176 | .display_name |
178 | .as_ref() | 177 | .as_ref() |
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 28b7a20c5..52ee401d9 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -1208,7 +1208,7 @@ fn is_macro_rules(path: &ModPath) -> bool { | |||
1208 | #[cfg(test)] | 1208 | #[cfg(test)] |
1209 | mod tests { | 1209 | mod tests { |
1210 | use crate::{db::DefDatabase, test_db::TestDB}; | 1210 | use crate::{db::DefDatabase, test_db::TestDB}; |
1211 | use ra_arena::Arena; | 1211 | use arena::Arena; |
1212 | use ra_db::{fixture::WithFixture, SourceDatabase}; | 1212 | use ra_db::{fixture::WithFixture, SourceDatabase}; |
1213 | 1213 | ||
1214 | use super::*; | 1214 | use super::*; |
diff --git a/crates/ra_hir_def/src/src.rs b/crates/ra_hir_def/src/src.rs index 043b93fad..7a79b0314 100644 --- a/crates/ra_hir_def/src/src.rs +++ b/crates/ra_hir_def/src/src.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Utilities for mapping between hir IDs and the surface syntax. | 1 | //! Utilities for mapping between hir IDs and the surface syntax. |
2 | 2 | ||
3 | use arena::map::ArenaMap; | ||
3 | use hir_expand::InFile; | 4 | use hir_expand::InFile; |
4 | use ra_arena::map::ArenaMap; | ||
5 | 5 | ||
6 | use crate::{db::DefDatabase, item_tree::ItemTreeNode, AssocItemLoc, ItemLoc}; | 6 | use crate::{db::DefDatabase, item_tree::ItemTreeNode, AssocItemLoc, ItemLoc}; |
7 | 7 | ||
diff --git a/crates/ra_hir_def/src/trace.rs b/crates/ra_hir_def/src/trace.rs index ced07577d..fd64e7018 100644 --- a/crates/ra_hir_def/src/trace.rs +++ b/crates/ra_hir_def/src/trace.rs | |||
@@ -9,7 +9,7 @@ | |||
9 | //! absolute offsets. The `Trace` structure (inspired, at least in name, by | 9 | //! absolute offsets. The `Trace` structure (inspired, at least in name, by |
10 | //! Kotlin's `BindingTrace`) allows use the same code to compute both | 10 | //! Kotlin's `BindingTrace`) allows use the same code to compute both |
11 | //! projections. | 11 | //! projections. |
12 | use ra_arena::{map::ArenaMap, Arena, Idx, RawId}; | 12 | use arena::{map::ArenaMap, Arena, Idx, RawId}; |
13 | 13 | ||
14 | pub(crate) struct Trace<T, V> { | 14 | pub(crate) struct Trace<T, V> { |
15 | arena: Option<Arena<T>>, | 15 | arena: Option<Arena<T>>, |
diff --git a/crates/ra_hir_expand/Cargo.toml b/crates/ra_hir_expand/Cargo.toml index 6da0e2a16..711a93c56 100644 --- a/crates/ra_hir_expand/Cargo.toml +++ b/crates/ra_hir_expand/Cargo.toml | |||
@@ -13,11 +13,11 @@ log = "0.4.8" | |||
13 | either = "1.5.3" | 13 | either = "1.5.3" |
14 | rustc-hash = "1.0.0" | 14 | rustc-hash = "1.0.0" |
15 | 15 | ||
16 | ra_arena = { path = "../ra_arena" } | 16 | arena = { path = "../arena" } |
17 | ra_db = { path = "../ra_db" } | 17 | ra_db = { path = "../ra_db" } |
18 | ra_syntax = { path = "../ra_syntax" } | 18 | ra_syntax = { path = "../ra_syntax" } |
19 | ra_parser = { path = "../ra_parser" } | 19 | ra_parser = { path = "../ra_parser" } |
20 | ra_prof = { path = "../ra_prof" } | 20 | profile = { path = "../profile" } |
21 | tt = { path = "../ra_tt", package = "ra_tt" } | 21 | tt = { path = "../ra_tt", package = "ra_tt" } |
22 | mbe = { path = "../ra_mbe", package = "ra_mbe" } | 22 | mbe = { path = "../ra_mbe", package = "ra_mbe" } |
23 | test_utils = { path = "../test_utils"} | 23 | test_utils = { path = "../test_utils"} |
diff --git a/crates/ra_hir_expand/src/ast_id_map.rs b/crates/ra_hir_expand/src/ast_id_map.rs index 8bfe1b4ba..703a85b0f 100644 --- a/crates/ra_hir_expand/src/ast_id_map.rs +++ b/crates/ra_hir_expand/src/ast_id_map.rs | |||
@@ -12,7 +12,7 @@ use std::{ | |||
12 | marker::PhantomData, | 12 | marker::PhantomData, |
13 | }; | 13 | }; |
14 | 14 | ||
15 | use ra_arena::{Arena, Idx}; | 15 | use arena::{Arena, Idx}; |
16 | use ra_syntax::{ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr}; | 16 | use ra_syntax::{ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr}; |
17 | 17 | ||
18 | /// `AstId` points to an AST node in a specific file. | 18 | /// `AstId` points to an AST node in a specific file. |
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index f3b7cd492..f30528b3e 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs | |||
@@ -5,7 +5,6 @@ use std::sync::Arc; | |||
5 | use mbe::{ExpandResult, MacroRules}; | 5 | use mbe::{ExpandResult, MacroRules}; |
6 | use ra_db::{salsa, SourceDatabase}; | 6 | use ra_db::{salsa, SourceDatabase}; |
7 | use ra_parser::FragmentKind; | 7 | use ra_parser::FragmentKind; |
8 | use ra_prof::profile; | ||
9 | use ra_syntax::{algo::diff, AstNode, GreenNode, Parse, SyntaxKind::*, SyntaxNode}; | 8 | use ra_syntax::{algo::diff, AstNode, GreenNode, Parse, SyntaxKind::*, SyntaxNode}; |
10 | 9 | ||
11 | use crate::{ | 10 | use crate::{ |
@@ -278,7 +277,7 @@ pub fn parse_macro_with_arg( | |||
278 | macro_file: MacroFile, | 277 | macro_file: MacroFile, |
279 | arg: Option<Arc<(tt::Subtree, mbe::TokenMap)>>, | 278 | arg: Option<Arc<(tt::Subtree, mbe::TokenMap)>>, |
280 | ) -> Option<(Parse<SyntaxNode>, Arc<mbe::TokenMap>)> { | 279 | ) -> Option<(Parse<SyntaxNode>, Arc<mbe::TokenMap>)> { |
281 | let _p = profile("parse_macro_query"); | 280 | let _p = profile::span("parse_macro_query"); |
282 | 281 | ||
283 | let macro_call_id = macro_file.macro_call_id; | 282 | let macro_call_id = macro_file.macro_call_id; |
284 | let (tt, err) = if let Some(arg) = arg { | 283 | let (tt, err) = if let Some(arg) = arg { |
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml index 83397d579..380d5e601 100644 --- a/crates/ra_hir_ty/Cargo.toml +++ b/crates/ra_hir_ty/Cargo.toml | |||
@@ -20,9 +20,9 @@ stdx = { path = "../stdx" } | |||
20 | 20 | ||
21 | hir_def = { path = "../ra_hir_def", package = "ra_hir_def" } | 21 | hir_def = { path = "../ra_hir_def", package = "ra_hir_def" } |
22 | hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } | 22 | hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } |
23 | ra_arena = { path = "../ra_arena" } | 23 | arena = { path = "../arena" } |
24 | ra_db = { path = "../ra_db" } | 24 | ra_db = { path = "../ra_db" } |
25 | ra_prof = { path = "../ra_prof" } | 25 | profile = { path = "../profile" } |
26 | ra_syntax = { path = "../ra_syntax" } | 26 | ra_syntax = { path = "../ra_syntax" } |
27 | test_utils = { path = "../test_utils" } | 27 | test_utils = { path = "../test_utils" } |
28 | 28 | ||
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs index c773adc67..7a28673b1 100644 --- a/crates/ra_hir_ty/src/db.rs +++ b/crates/ra_hir_ty/src/db.rs | |||
@@ -2,13 +2,12 @@ | |||
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use arena::map::ArenaMap; | ||
5 | use hir_def::{ | 6 | use hir_def::{ |
6 | db::DefDatabase, expr::ExprId, DefWithBodyId, FunctionId, GenericDefId, ImplId, LocalFieldId, | 7 | db::DefDatabase, expr::ExprId, DefWithBodyId, FunctionId, GenericDefId, ImplId, LocalFieldId, |
7 | TypeParamId, VariantId, | 8 | TypeParamId, VariantId, |
8 | }; | 9 | }; |
9 | use ra_arena::map::ArenaMap; | ||
10 | use ra_db::{impl_intern_key, salsa, CrateId, Upcast}; | 10 | use ra_db::{impl_intern_key, salsa, CrateId, Upcast}; |
11 | use ra_prof::profile; | ||
12 | 11 | ||
13 | use crate::{ | 12 | use crate::{ |
14 | method_resolution::{InherentImpls, TraitImpls}, | 13 | method_resolution::{InherentImpls, TraitImpls}, |
@@ -123,7 +122,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> { | |||
123 | } | 122 | } |
124 | 123 | ||
125 | fn infer_wait(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { | 124 | fn infer_wait(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { |
126 | let _p = profile("infer:wait").detail(|| match def { | 125 | let _p = profile::span("infer:wait").detail(|| match def { |
127 | DefWithBodyId::FunctionId(it) => db.function_data(it).name.to_string(), | 126 | DefWithBodyId::FunctionId(it) => db.function_data(it).name.to_string(), |
128 | DefWithBodyId::StaticId(it) => { | 127 | DefWithBodyId::StaticId(it) => { |
129 | db.static_data(it).name.clone().unwrap_or_else(Name::missing).to_string() | 128 | db.static_data(it).name.clone().unwrap_or_else(Name::missing).to_string() |
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs index 7ab7f79db..55c02c1fe 100644 --- a/crates/ra_hir_ty/src/diagnostics.rs +++ b/crates/ra_hir_ty/src/diagnostics.rs | |||
@@ -8,7 +8,6 @@ use std::any::Any; | |||
8 | use hir_def::DefWithBodyId; | 8 | use hir_def::DefWithBodyId; |
9 | use hir_expand::diagnostics::{Diagnostic, DiagnosticSink}; | 9 | use hir_expand::diagnostics::{Diagnostic, DiagnosticSink}; |
10 | use hir_expand::{name::Name, HirFileId, InFile}; | 10 | use hir_expand::{name::Name, HirFileId, InFile}; |
11 | use ra_prof::profile; | ||
12 | use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; | 11 | use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; |
13 | use stdx::format_to; | 12 | use stdx::format_to; |
14 | 13 | ||
@@ -17,7 +16,7 @@ use crate::db::HirDatabase; | |||
17 | pub use crate::diagnostics::expr::{record_literal_missing_fields, record_pattern_missing_fields}; | 16 | pub use crate::diagnostics::expr::{record_literal_missing_fields, record_pattern_missing_fields}; |
18 | 17 | ||
19 | pub fn validate_body(db: &dyn HirDatabase, owner: DefWithBodyId, sink: &mut DiagnosticSink<'_>) { | 18 | pub fn validate_body(db: &dyn HirDatabase, owner: DefWithBodyId, sink: &mut DiagnosticSink<'_>) { |
20 | let _p = profile("validate_body"); | 19 | let _p = profile::span("validate_body"); |
21 | let infer = db.infer(owner); | 20 | let infer = db.infer(owner); |
22 | infer.add_diagnostics(db, owner, sink); | 21 | infer.add_diagnostics(db, owner, sink); |
23 | let mut validator = expr::ExprValidator::new(owner, infer.clone(), sink); | 22 | let mut validator = expr::ExprValidator::new(owner, infer.clone(), sink); |
diff --git a/crates/ra_hir_ty/src/diagnostics/match_check.rs b/crates/ra_hir_ty/src/diagnostics/match_check.rs index deca244db..7f007f1d6 100644 --- a/crates/ra_hir_ty/src/diagnostics/match_check.rs +++ b/crates/ra_hir_ty/src/diagnostics/match_check.rs | |||
@@ -218,13 +218,13 @@ | |||
218 | //! ``` | 218 | //! ``` |
219 | use std::sync::Arc; | 219 | use std::sync::Arc; |
220 | 220 | ||
221 | use arena::Idx; | ||
221 | use hir_def::{ | 222 | use hir_def::{ |
222 | adt::VariantData, | 223 | adt::VariantData, |
223 | body::Body, | 224 | body::Body, |
224 | expr::{Expr, Literal, Pat, PatId}, | 225 | expr::{Expr, Literal, Pat, PatId}, |
225 | AdtId, EnumVariantId, VariantId, | 226 | AdtId, EnumVariantId, VariantId, |
226 | }; | 227 | }; |
227 | use ra_arena::Idx; | ||
228 | use smallvec::{smallvec, SmallVec}; | 228 | use smallvec::{smallvec, SmallVec}; |
229 | 229 | ||
230 | use crate::{db::HirDatabase, ApplicationTy, InferenceResult, Ty, TypeCtor}; | 230 | use crate::{db::HirDatabase, ApplicationTy, InferenceResult, Ty, TypeCtor}; |
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs index 3d12039a6..784ae1c3c 100644 --- a/crates/ra_hir_ty/src/infer.rs +++ b/crates/ra_hir_ty/src/infer.rs | |||
@@ -18,6 +18,7 @@ use std::mem; | |||
18 | use std::ops::Index; | 18 | use std::ops::Index; |
19 | use std::sync::Arc; | 19 | use std::sync::Arc; |
20 | 20 | ||
21 | use arena::map::ArenaMap; | ||
21 | use hir_def::{ | 22 | use hir_def::{ |
22 | body::Body, | 23 | body::Body, |
23 | data::{ConstData, FunctionData, StaticData}, | 24 | data::{ConstData, FunctionData, StaticData}, |
@@ -30,8 +31,6 @@ use hir_def::{ | |||
30 | TypeAliasId, VariantId, | 31 | TypeAliasId, VariantId, |
31 | }; | 32 | }; |
32 | use hir_expand::{diagnostics::DiagnosticSink, name::name}; | 33 | use hir_expand::{diagnostics::DiagnosticSink, name::name}; |
33 | use ra_arena::map::ArenaMap; | ||
34 | use ra_prof::profile; | ||
35 | use ra_syntax::SmolStr; | 34 | use ra_syntax::SmolStr; |
36 | use rustc_hash::FxHashMap; | 35 | use rustc_hash::FxHashMap; |
37 | use stdx::impl_from; | 36 | use stdx::impl_from; |
@@ -64,7 +63,7 @@ mod coerce; | |||
64 | 63 | ||
65 | /// The entry point of type inference. | 64 | /// The entry point of type inference. |
66 | pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { | 65 | pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { |
67 | let _p = profile("infer_query"); | 66 | let _p = profile::span("infer_query"); |
68 | let resolver = def.resolver(db.upcast()); | 67 | let resolver = def.resolver(db.upcast()); |
69 | let mut ctx = InferenceContext::new(db, def, resolver); | 68 | let mut ctx = InferenceContext::new(db, def, resolver); |
70 | 69 | ||
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs index 7638f167b..7b805fe7a 100644 --- a/crates/ra_hir_ty/src/lower.rs +++ b/crates/ra_hir_ty/src/lower.rs | |||
@@ -7,6 +7,7 @@ | |||
7 | //! This usually involves resolving names, collecting generic arguments etc. | 7 | //! This usually involves resolving names, collecting generic arguments etc. |
8 | use std::{iter, sync::Arc}; | 8 | use std::{iter, sync::Arc}; |
9 | 9 | ||
10 | use arena::map::ArenaMap; | ||
10 | use hir_def::{ | 11 | use hir_def::{ |
11 | adt::StructKind, | 12 | adt::StructKind, |
12 | builtin_type::BuiltinType, | 13 | builtin_type::BuiltinType, |
@@ -19,7 +20,6 @@ use hir_def::{ | |||
19 | UnionId, VariantId, | 20 | UnionId, VariantId, |
20 | }; | 21 | }; |
21 | use hir_expand::name::Name; | 22 | use hir_expand::name::Name; |
22 | use ra_arena::map::ArenaMap; | ||
23 | use ra_db::CrateId; | 23 | use ra_db::CrateId; |
24 | use smallvec::SmallVec; | 24 | use smallvec::SmallVec; |
25 | use stdx::impl_from; | 25 | use stdx::impl_from; |
diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/ra_hir_ty/src/method_resolution.rs index fb4b30a13..3b3bee6a7 100644 --- a/crates/ra_hir_ty/src/method_resolution.rs +++ b/crates/ra_hir_ty/src/method_resolution.rs | |||
@@ -13,7 +13,6 @@ use hir_def::{ | |||
13 | }; | 13 | }; |
14 | use hir_expand::name::Name; | 14 | use hir_expand::name::Name; |
15 | use ra_db::CrateId; | 15 | use ra_db::CrateId; |
16 | use ra_prof::profile; | ||
17 | use rustc_hash::{FxHashMap, FxHashSet}; | 16 | use rustc_hash::{FxHashMap, FxHashSet}; |
18 | 17 | ||
19 | use super::Substs; | 18 | use super::Substs; |
@@ -109,7 +108,7 @@ pub struct TraitImpls { | |||
109 | 108 | ||
110 | impl TraitImpls { | 109 | impl TraitImpls { |
111 | pub(crate) fn trait_impls_in_crate_query(db: &dyn HirDatabase, krate: CrateId) -> Arc<Self> { | 110 | pub(crate) fn trait_impls_in_crate_query(db: &dyn HirDatabase, krate: CrateId) -> Arc<Self> { |
112 | let _p = profile("trait_impls_in_crate_query"); | 111 | let _p = profile::span("trait_impls_in_crate_query"); |
113 | let mut impls = Self { map: FxHashMap::default() }; | 112 | let mut impls = Self { map: FxHashMap::default() }; |
114 | 113 | ||
115 | let crate_def_map = db.crate_def_map(krate); | 114 | let crate_def_map = db.crate_def_map(krate); |
@@ -135,7 +134,7 @@ impl TraitImpls { | |||
135 | } | 134 | } |
136 | 135 | ||
137 | pub(crate) fn trait_impls_in_deps_query(db: &dyn HirDatabase, krate: CrateId) -> Arc<Self> { | 136 | pub(crate) fn trait_impls_in_deps_query(db: &dyn HirDatabase, krate: CrateId) -> Arc<Self> { |
138 | let _p = profile("trait_impls_in_deps_query"); | 137 | let _p = profile::span("trait_impls_in_deps_query"); |
139 | let crate_graph = db.crate_graph(); | 138 | let crate_graph = db.crate_graph(); |
140 | let mut res = Self { map: FxHashMap::default() }; | 139 | let mut res = Self { map: FxHashMap::default() }; |
141 | 140 | ||
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs index 3f6d2cf35..2576a9dfc 100644 --- a/crates/ra_hir_ty/src/traits.rs +++ b/crates/ra_hir_ty/src/traits.rs | |||
@@ -5,7 +5,6 @@ use chalk_ir::cast::Cast; | |||
5 | use chalk_solve::Solver; | 5 | use chalk_solve::Solver; |
6 | use hir_def::{lang_item::LangItemTarget, TraitId}; | 6 | use hir_def::{lang_item::LangItemTarget, TraitId}; |
7 | use ra_db::CrateId; | 7 | use ra_db::CrateId; |
8 | use ra_prof::profile; | ||
9 | 8 | ||
10 | use crate::{db::HirDatabase, DebruijnIndex, Substs}; | 9 | use crate::{db::HirDatabase, DebruijnIndex, Substs}; |
11 | 10 | ||
@@ -125,7 +124,7 @@ pub(crate) fn trait_solve_query( | |||
125 | krate: CrateId, | 124 | krate: CrateId, |
126 | goal: Canonical<InEnvironment<Obligation>>, | 125 | goal: Canonical<InEnvironment<Obligation>>, |
127 | ) -> Option<Solution> { | 126 | ) -> Option<Solution> { |
128 | let _p = profile("trait_solve_query").detail(|| match &goal.value.value { | 127 | let _p = profile::span("trait_solve_query").detail(|| match &goal.value.value { |
129 | Obligation::Trait(it) => db.trait_data(it.trait_).name.to_string(), | 128 | Obligation::Trait(it) => db.trait_data(it.trait_).name.to_string(), |
130 | Obligation::Projection(_) => "projection".to_string(), | 129 | Obligation::Projection(_) => "projection".to_string(), |
131 | }); | 130 | }); |
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 1c7065364..3b6af5c9a 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -410,7 +410,7 @@ pub(crate) fn impl_datum_query( | |||
410 | krate: CrateId, | 410 | krate: CrateId, |
411 | impl_id: ImplId, | 411 | impl_id: ImplId, |
412 | ) -> Arc<ImplDatum> { | 412 | ) -> Arc<ImplDatum> { |
413 | let _p = ra_prof::profile("impl_datum"); | 413 | let _p = profile::span("impl_datum"); |
414 | debug!("impl_datum {:?}", impl_id); | 414 | debug!("impl_datum {:?}", impl_id); |
415 | let impl_: hir_def::ImplId = from_chalk(db, impl_id); | 415 | let impl_: hir_def::ImplId = from_chalk(db, impl_id); |
416 | impl_def_datum(db, krate, impl_id, impl_) | 416 | impl_def_datum(db, krate, impl_id, impl_) |
diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml index f4181c4eb..bbc9ba4e7 100644 --- a/crates/ra_ide/Cargo.toml +++ b/crates/ra_ide/Cargo.toml | |||
@@ -27,7 +27,7 @@ ra_db = { path = "../ra_db" } | |||
27 | ra_ide_db = { path = "../ra_ide_db" } | 27 | ra_ide_db = { path = "../ra_ide_db" } |
28 | ra_cfg = { path = "../ra_cfg" } | 28 | ra_cfg = { path = "../ra_cfg" } |
29 | ra_fmt = { path = "../ra_fmt" } | 29 | ra_fmt = { path = "../ra_fmt" } |
30 | ra_prof = { path = "../ra_prof" } | 30 | profile = { path = "../profile" } |
31 | test_utils = { path = "../test_utils" } | 31 | test_utils = { path = "../test_utils" } |
32 | ra_assists = { path = "../ra_assists" } | 32 | ra_assists = { path = "../ra_assists" } |
33 | ra_ssr = { path = "../ra_ssr" } | 33 | ra_ssr = { path = "../ra_ssr" } |
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 1046d7ab3..07bf133bd 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -10,7 +10,6 @@ use hir::{diagnostics::DiagnosticSinkBuilder, Semantics}; | |||
10 | use itertools::Itertools; | 10 | use itertools::Itertools; |
11 | use ra_db::SourceDatabase; | 11 | use ra_db::SourceDatabase; |
12 | use ra_ide_db::RootDatabase; | 12 | use ra_ide_db::RootDatabase; |
13 | use ra_prof::profile; | ||
14 | use ra_syntax::{ | 13 | use ra_syntax::{ |
15 | ast::{self, AstNode}, | 14 | ast::{self, AstNode}, |
16 | SyntaxNode, TextRange, T, | 15 | SyntaxNode, TextRange, T, |
@@ -33,7 +32,7 @@ pub(crate) fn diagnostics( | |||
33 | file_id: FileId, | 32 | file_id: FileId, |
34 | enable_experimental: bool, | 33 | enable_experimental: bool, |
35 | ) -> Vec<Diagnostic> { | 34 | ) -> Vec<Diagnostic> { |
36 | let _p = profile("diagnostics"); | 35 | let _p = profile::span("diagnostics"); |
37 | let sema = Semantics::new(db); | 36 | let sema = Semantics::new(db); |
38 | let parse = db.parse(file_id); | 37 | let parse = db.parse(file_id); |
39 | let mut res = Vec::new(); | 38 | let mut res = Vec::new(); |
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 1bacead63..920b04e8d 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -1,6 +1,5 @@ | |||
1 | use hir::{Adt, Callable, HirDisplay, Semantics, Type}; | 1 | use hir::{Adt, Callable, HirDisplay, Semantics, Type}; |
2 | use ra_ide_db::RootDatabase; | 2 | use ra_ide_db::RootDatabase; |
3 | use ra_prof::profile; | ||
4 | use ra_syntax::{ | 3 | use ra_syntax::{ |
5 | ast::{self, ArgListOwner, AstNode}, | 4 | ast::{self, ArgListOwner, AstNode}, |
6 | match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T, | 5 | match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T, |
@@ -64,7 +63,7 @@ pub(crate) fn inlay_hints( | |||
64 | file_id: FileId, | 63 | file_id: FileId, |
65 | config: &InlayHintsConfig, | 64 | config: &InlayHintsConfig, |
66 | ) -> Vec<InlayHint> { | 65 | ) -> Vec<InlayHint> { |
67 | let _p = profile("inlay_hints"); | 66 | let _p = profile::span("inlay_hints"); |
68 | let sema = Semantics::new(db); | 67 | let sema = Semantics::new(db); |
69 | let file = sema.parse(file_id); | 68 | let file = sema.parse(file_id); |
70 | 69 | ||
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 89fcb6f17..bfcf5d750 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -176,7 +176,7 @@ impl AnalysisHost { | |||
176 | self.db.collect_garbage(); | 176 | self.db.collect_garbage(); |
177 | } | 177 | } |
178 | /// NB: this clears the database | 178 | /// NB: this clears the database |
179 | pub fn per_query_memory_usage(&mut self) -> Vec<(String, ra_prof::Bytes)> { | 179 | pub fn per_query_memory_usage(&mut self) -> Vec<(String, profile::Bytes)> { |
180 | self.db.per_query_memory_usage() | 180 | self.db.per_query_memory_usage() |
181 | } | 181 | } |
182 | pub fn request_cancellation(&mut self) { | 182 | pub fn request_cancellation(&mut self) { |
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index 453985de3..c4eea3a45 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -17,7 +17,6 @@ use ra_ide_db::{ | |||
17 | search::SearchScope, | 17 | search::SearchScope, |
18 | RootDatabase, | 18 | RootDatabase, |
19 | }; | 19 | }; |
20 | use ra_prof::profile; | ||
21 | use ra_syntax::{ | 20 | use ra_syntax::{ |
22 | algo::find_node_at_offset, | 21 | algo::find_node_at_offset, |
23 | ast::{self, NameOwner}, | 22 | ast::{self, NameOwner}, |
@@ -90,7 +89,7 @@ pub(crate) fn find_all_refs( | |||
90 | position: FilePosition, | 89 | position: FilePosition, |
91 | search_scope: Option<SearchScope>, | 90 | search_scope: Option<SearchScope>, |
92 | ) -> Option<RangeInfo<ReferenceSearchResult>> { | 91 | ) -> Option<RangeInfo<ReferenceSearchResult>> { |
93 | let _p = profile("find_all_refs"); | 92 | let _p = profile::span("find_all_refs"); |
94 | let syntax = sema.parse(position.file_id).syntax().clone(); | 93 | let syntax = sema.parse(position.file_id).syntax().clone(); |
95 | 94 | ||
96 | let (opt_name, search_kind) = if let Some(name) = | 95 | let (opt_name, search_kind) = if let Some(name) = |
diff --git a/crates/ra_ide/src/status.rs b/crates/ra_ide/src/status.rs index 08e6f69cb..009bb662f 100644 --- a/crates/ra_ide/src/status.rs +++ b/crates/ra_ide/src/status.rs | |||
@@ -1,6 +1,7 @@ | |||
1 | use std::{fmt, iter::FromIterator, sync::Arc}; | 1 | use std::{fmt, iter::FromIterator, sync::Arc}; |
2 | 2 | ||
3 | use hir::MacroFile; | 3 | use hir::MacroFile; |
4 | use profile::{memory_usage, Bytes}; | ||
4 | use ra_db::{ | 5 | use ra_db::{ |
5 | salsa::debug::{DebugQueryTable, TableEntry}, | 6 | salsa::debug::{DebugQueryTable, TableEntry}, |
6 | FileTextQuery, SourceRootId, | 7 | FileTextQuery, SourceRootId, |
@@ -9,7 +10,6 @@ use ra_ide_db::{ | |||
9 | symbol_index::{LibrarySymbolsQuery, SymbolIndex}, | 10 | symbol_index::{LibrarySymbolsQuery, SymbolIndex}, |
10 | RootDatabase, | 11 | RootDatabase, |
11 | }; | 12 | }; |
12 | use ra_prof::{memory_usage, Bytes}; | ||
13 | use ra_syntax::{ast, Parse, SyntaxNode}; | 13 | use ra_syntax::{ast, Parse, SyntaxNode}; |
14 | use rustc_hash::FxHashMap; | 14 | use rustc_hash::FxHashMap; |
15 | 15 | ||
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index c10e15db8..ebdf05127 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -9,7 +9,6 @@ use ra_ide_db::{ | |||
9 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, | 9 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, |
10 | RootDatabase, | 10 | RootDatabase, |
11 | }; | 11 | }; |
12 | use ra_prof::profile; | ||
13 | use ra_syntax::{ | 12 | use ra_syntax::{ |
14 | ast::{self, HasFormatSpecifier}, | 13 | ast::{self, HasFormatSpecifier}, |
15 | AstNode, AstToken, Direction, NodeOrToken, SyntaxElement, | 14 | AstNode, AstToken, Direction, NodeOrToken, SyntaxElement, |
@@ -46,7 +45,7 @@ pub(crate) fn highlight( | |||
46 | range_to_highlight: Option<TextRange>, | 45 | range_to_highlight: Option<TextRange>, |
47 | syntactic_name_ref_highlighting: bool, | 46 | syntactic_name_ref_highlighting: bool, |
48 | ) -> Vec<HighlightedRange> { | 47 | ) -> Vec<HighlightedRange> { |
49 | let _p = profile("highlight"); | 48 | let _p = profile::span("highlight"); |
50 | let sema = Semantics::new(db); | 49 | let sema = Semantics::new(db); |
51 | 50 | ||
52 | // Determine the root based on the given range. | 51 | // Determine the root based on the given range. |
diff --git a/crates/ra_ide_db/Cargo.toml b/crates/ra_ide_db/Cargo.toml index 2716a38cc..92b8ef82a 100644 --- a/crates/ra_ide_db/Cargo.toml +++ b/crates/ra_ide_db/Cargo.toml | |||
@@ -24,7 +24,7 @@ stdx = { path = "../stdx" } | |||
24 | ra_syntax = { path = "../ra_syntax" } | 24 | ra_syntax = { path = "../ra_syntax" } |
25 | ra_text_edit = { path = "../ra_text_edit" } | 25 | ra_text_edit = { path = "../ra_text_edit" } |
26 | ra_db = { path = "../ra_db" } | 26 | ra_db = { path = "../ra_db" } |
27 | ra_prof = { path = "../ra_prof" } | 27 | profile = { path = "../profile" } |
28 | test_utils = { path = "../test_utils" } | 28 | test_utils = { path = "../test_utils" } |
29 | 29 | ||
30 | # ra_ide should depend only on the top-level `hir` package. if you need | 30 | # ra_ide should depend only on the top-level `hir` package. if you need |
diff --git a/crates/ra_ide_db/src/change.rs b/crates/ra_ide_db/src/change.rs index b13df8b85..7a4e04ca9 100644 --- a/crates/ra_ide_db/src/change.rs +++ b/crates/ra_ide_db/src/change.rs | |||
@@ -3,11 +3,11 @@ | |||
3 | 3 | ||
4 | use std::{fmt, sync::Arc, time}; | 4 | use std::{fmt, sync::Arc, time}; |
5 | 5 | ||
6 | use profile::{memory_usage, Bytes}; | ||
6 | use ra_db::{ | 7 | use ra_db::{ |
7 | salsa::{Database, Durability, SweepStrategy}, | 8 | salsa::{Database, Durability, SweepStrategy}, |
8 | CrateGraph, FileId, SourceDatabase, SourceDatabaseExt, SourceRoot, SourceRootId, | 9 | CrateGraph, FileId, SourceDatabase, SourceDatabaseExt, SourceRoot, SourceRootId, |
9 | }; | 10 | }; |
10 | use ra_prof::{memory_usage, profile, Bytes}; | ||
11 | use rustc_hash::FxHashSet; | 11 | use rustc_hash::FxHashSet; |
12 | 12 | ||
13 | use crate::{symbol_index::SymbolsDatabase, RootDatabase}; | 13 | use crate::{symbol_index::SymbolsDatabase, RootDatabase}; |
@@ -85,12 +85,12 @@ const GC_COOLDOWN: time::Duration = time::Duration::from_millis(100); | |||
85 | 85 | ||
86 | impl RootDatabase { | 86 | impl RootDatabase { |
87 | pub fn request_cancellation(&mut self) { | 87 | pub fn request_cancellation(&mut self) { |
88 | let _p = profile("RootDatabase::request_cancellation"); | 88 | let _p = profile::span("RootDatabase::request_cancellation"); |
89 | self.salsa_runtime_mut().synthetic_write(Durability::LOW); | 89 | self.salsa_runtime_mut().synthetic_write(Durability::LOW); |
90 | } | 90 | } |
91 | 91 | ||
92 | pub fn apply_change(&mut self, change: AnalysisChange) { | 92 | pub fn apply_change(&mut self, change: AnalysisChange) { |
93 | let _p = profile("RootDatabase::apply_change"); | 93 | let _p = profile::span("RootDatabase::apply_change"); |
94 | self.request_cancellation(); | 94 | self.request_cancellation(); |
95 | log::info!("apply_change {:?}", change); | 95 | log::info!("apply_change {:?}", change); |
96 | if let Some(roots) = change.roots { | 96 | if let Some(roots) = change.roots { |
@@ -141,7 +141,7 @@ impl RootDatabase { | |||
141 | return; | 141 | return; |
142 | } | 142 | } |
143 | 143 | ||
144 | let _p = profile("RootDatabase::collect_garbage"); | 144 | let _p = profile::span("RootDatabase::collect_garbage"); |
145 | self.last_gc = crate::wasm_shims::Instant::now(); | 145 | self.last_gc = crate::wasm_shims::Instant::now(); |
146 | 146 | ||
147 | let sweep = SweepStrategy::default().discard_values().sweep_all_revisions(); | 147 | let sweep = SweepStrategy::default().discard_values().sweep_all_revisions(); |
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 9bb95277d..d46d1fe71 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs | |||
@@ -9,7 +9,6 @@ use hir::{ | |||
9 | db::HirDatabase, Crate, Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, | 9 | db::HirDatabase, Crate, Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, |
10 | Name, PathResolution, Semantics, TypeParam, Visibility, | 10 | Name, PathResolution, Semantics, TypeParam, Visibility, |
11 | }; | 11 | }; |
12 | use ra_prof::profile; | ||
13 | use ra_syntax::{ | 12 | use ra_syntax::{ |
14 | ast::{self, AstNode}, | 13 | ast::{self, AstNode}, |
15 | match_ast, SyntaxNode, | 14 | match_ast, SyntaxNode, |
@@ -110,7 +109,7 @@ impl NameClass { | |||
110 | } | 109 | } |
111 | 110 | ||
112 | pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option<NameClass> { | 111 | pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option<NameClass> { |
113 | let _p = profile("classify_name"); | 112 | let _p = profile::span("classify_name"); |
114 | 113 | ||
115 | let parent = name.syntax().parent()?; | 114 | let parent = name.syntax().parent()?; |
116 | 115 | ||
@@ -249,7 +248,7 @@ pub fn classify_name_ref( | |||
249 | sema: &Semantics<RootDatabase>, | 248 | sema: &Semantics<RootDatabase>, |
250 | name_ref: &ast::NameRef, | 249 | name_ref: &ast::NameRef, |
251 | ) -> Option<NameRefClass> { | 250 | ) -> Option<NameRefClass> { |
252 | let _p = profile("classify_name_ref"); | 251 | let _p = profile::span("classify_name_ref"); |
253 | 252 | ||
254 | let parent = name_ref.syntax().parent()?; | 253 | let parent = name_ref.syntax().parent()?; |
255 | 254 | ||
diff --git a/crates/ra_ide_db/src/imports_locator.rs b/crates/ra_ide_db/src/imports_locator.rs index 9e040973b..d510ce3b7 100644 --- a/crates/ra_ide_db/src/imports_locator.rs +++ b/crates/ra_ide_db/src/imports_locator.rs | |||
@@ -2,7 +2,6 @@ | |||
2 | //! Later, this should be moved away to a separate crate that is accessible from the ra_assists module. | 2 | //! Later, this should be moved away to a separate crate that is accessible from the ra_assists module. |
3 | 3 | ||
4 | use hir::{Crate, MacroDef, ModuleDef, Semantics}; | 4 | use hir::{Crate, MacroDef, ModuleDef, Semantics}; |
5 | use ra_prof::profile; | ||
6 | use ra_syntax::{ast, AstNode, SyntaxKind::NAME}; | 5 | use ra_syntax::{ast, AstNode, SyntaxKind::NAME}; |
7 | 6 | ||
8 | use crate::{ | 7 | use crate::{ |
@@ -18,7 +17,7 @@ pub fn find_imports<'a>( | |||
18 | krate: Crate, | 17 | krate: Crate, |
19 | name_to_import: &str, | 18 | name_to_import: &str, |
20 | ) -> Vec<Either<ModuleDef, MacroDef>> { | 19 | ) -> Vec<Either<ModuleDef, MacroDef>> { |
21 | let _p = profile("search_for_imports"); | 20 | let _p = profile::span("search_for_imports"); |
22 | let db = sema.db; | 21 | let db = sema.db; |
23 | 22 | ||
24 | // Query dependencies first. | 23 | // Query dependencies first. |
@@ -51,7 +50,7 @@ fn get_name_definition<'a>( | |||
51 | sema: &Semantics<'a, RootDatabase>, | 50 | sema: &Semantics<'a, RootDatabase>, |
52 | import_candidate: &FileSymbol, | 51 | import_candidate: &FileSymbol, |
53 | ) -> Option<Definition> { | 52 | ) -> Option<Definition> { |
54 | let _p = profile("get_name_definition"); | 53 | let _p = profile::span("get_name_definition"); |
55 | let file_id = import_candidate.file_id; | 54 | let file_id = import_candidate.file_id; |
56 | 55 | ||
57 | let candidate_node = import_candidate.ptr.to_node(sema.parse(file_id).syntax()); | 56 | let candidate_node = import_candidate.ptr.to_node(sema.parse(file_id).syntax()); |
diff --git a/crates/ra_ide_db/src/search.rs b/crates/ra_ide_db/src/search.rs index 0b862b449..d90b830d0 100644 --- a/crates/ra_ide_db/src/search.rs +++ b/crates/ra_ide_db/src/search.rs | |||
@@ -9,7 +9,6 @@ use std::{convert::TryInto, mem}; | |||
9 | use hir::{DefWithBody, HasSource, Module, ModuleSource, Semantics, Visibility}; | 9 | use hir::{DefWithBody, HasSource, Module, ModuleSource, Semantics, Visibility}; |
10 | use once_cell::unsync::Lazy; | 10 | use once_cell::unsync::Lazy; |
11 | use ra_db::{FileId, FileRange, SourceDatabaseExt}; | 11 | use ra_db::{FileId, FileRange, SourceDatabaseExt}; |
12 | use ra_prof::profile; | ||
13 | use ra_syntax::{ast, match_ast, AstNode, TextRange, TextSize}; | 12 | use ra_syntax::{ast, match_ast, AstNode, TextRange, TextSize}; |
14 | use rustc_hash::FxHashMap; | 13 | use rustc_hash::FxHashMap; |
15 | 14 | ||
@@ -107,7 +106,7 @@ impl IntoIterator for SearchScope { | |||
107 | 106 | ||
108 | impl Definition { | 107 | impl Definition { |
109 | fn search_scope(&self, db: &RootDatabase) -> SearchScope { | 108 | fn search_scope(&self, db: &RootDatabase) -> SearchScope { |
110 | let _p = profile("search_scope"); | 109 | let _p = profile::span("search_scope"); |
111 | let module = match self.module(db) { | 110 | let module = match self.module(db) { |
112 | Some(it) => it, | 111 | Some(it) => it, |
113 | None => return SearchScope::empty(), | 112 | None => return SearchScope::empty(), |
@@ -187,7 +186,7 @@ impl Definition { | |||
187 | sema: &Semantics<RootDatabase>, | 186 | sema: &Semantics<RootDatabase>, |
188 | search_scope: Option<SearchScope>, | 187 | search_scope: Option<SearchScope>, |
189 | ) -> Vec<Reference> { | 188 | ) -> Vec<Reference> { |
190 | let _p = profile("Definition::find_usages"); | 189 | let _p = profile::span("Definition::find_usages"); |
191 | 190 | ||
192 | let search_scope = { | 191 | let search_scope = { |
193 | let base = self.search_scope(sema.db); | 192 | let base = self.search_scope(sema.db); |
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs index 35a2c5be3..6ca8bb516 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ra_ide_db/src/symbol_index.rs | |||
@@ -34,7 +34,6 @@ use ra_db::{ | |||
34 | salsa::{self, ParallelDatabase}, | 34 | salsa::{self, ParallelDatabase}, |
35 | CrateId, FileId, SourceDatabaseExt, SourceRootId, | 35 | CrateId, FileId, SourceDatabaseExt, SourceRootId, |
36 | }; | 36 | }; |
37 | use ra_prof::profile; | ||
38 | use ra_syntax::{ | 37 | use ra_syntax::{ |
39 | ast::{self, NameOwner}, | 38 | ast::{self, NameOwner}, |
40 | match_ast, AstNode, Parse, SmolStr, SourceFile, | 39 | match_ast, AstNode, Parse, SmolStr, SourceFile, |
@@ -101,7 +100,7 @@ pub trait SymbolsDatabase: hir::db::HirDatabase + SourceDatabaseExt { | |||
101 | } | 100 | } |
102 | 101 | ||
103 | fn library_symbols(db: &dyn SymbolsDatabase) -> Arc<FxHashMap<SourceRootId, SymbolIndex>> { | 102 | fn library_symbols(db: &dyn SymbolsDatabase) -> Arc<FxHashMap<SourceRootId, SymbolIndex>> { |
104 | let _p = profile("library_symbols"); | 103 | let _p = profile::span("library_symbols"); |
105 | 104 | ||
106 | let roots = db.library_roots(); | 105 | let roots = db.library_roots(); |
107 | let res = roots | 106 | let res = roots |
@@ -162,7 +161,7 @@ impl<DB: ParallelDatabase> Clone for Snap<salsa::Snapshot<DB>> { | |||
162 | // | VS Code | kbd:[Ctrl+T] | 161 | // | VS Code | kbd:[Ctrl+T] |
163 | // |=== | 162 | // |=== |
164 | pub fn world_symbols(db: &RootDatabase, query: Query) -> Vec<FileSymbol> { | 163 | pub fn world_symbols(db: &RootDatabase, query: Query) -> Vec<FileSymbol> { |
165 | let _p = ra_prof::profile("world_symbols").detail(|| query.query.clone()); | 164 | let _p = profile::span("world_symbols").detail(|| query.query.clone()); |
166 | 165 | ||
167 | let tmp1; | 166 | let tmp1; |
168 | let tmp2; | 167 | let tmp2; |
diff --git a/crates/ra_project_model/Cargo.toml b/crates/ra_project_model/Cargo.toml index 99adea8e4..27b1f5d33 100644 --- a/crates/ra_project_model/Cargo.toml +++ b/crates/ra_project_model/Cargo.toml | |||
@@ -14,7 +14,7 @@ rustc-hash = "1.1.0" | |||
14 | 14 | ||
15 | cargo_metadata = "0.11.1" | 15 | cargo_metadata = "0.11.1" |
16 | 16 | ||
17 | ra_arena = { path = "../ra_arena" } | 17 | arena = { path = "../arena" } |
18 | ra_cfg = { path = "../ra_cfg" } | 18 | ra_cfg = { path = "../ra_cfg" } |
19 | ra_db = { path = "../ra_db" } | 19 | ra_db = { path = "../ra_db" } |
20 | ra_toolchain = { path = "../ra_toolchain" } | 20 | ra_toolchain = { path = "../ra_toolchain" } |
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 10513542e..a526d743d 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs | |||
@@ -8,9 +8,9 @@ use std::{ | |||
8 | }; | 8 | }; |
9 | 9 | ||
10 | use anyhow::{Context, Result}; | 10 | use anyhow::{Context, Result}; |
11 | use arena::{Arena, Idx}; | ||
11 | use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId}; | 12 | use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId}; |
12 | use paths::{AbsPath, AbsPathBuf}; | 13 | use paths::{AbsPath, AbsPathBuf}; |
13 | use ra_arena::{Arena, Idx}; | ||
14 | use ra_db::Edition; | 14 | use ra_db::Edition; |
15 | use rustc_hash::FxHashMap; | 15 | use rustc_hash::FxHashMap; |
16 | 16 | ||
diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/ra_project_model/src/sysroot.rs index a10ade375..6ef001769 100644 --- a/crates/ra_project_model/src/sysroot.rs +++ b/crates/ra_project_model/src/sysroot.rs | |||
@@ -3,8 +3,8 @@ | |||
3 | use std::{convert::TryFrom, env, ops, path::Path, process::Command}; | 3 | use std::{convert::TryFrom, env, ops, path::Path, process::Command}; |
4 | 4 | ||
5 | use anyhow::{bail, format_err, Result}; | 5 | use anyhow::{bail, format_err, Result}; |
6 | use arena::{Arena, Idx}; | ||
6 | use paths::{AbsPath, AbsPathBuf}; | 7 | use paths::{AbsPath, AbsPathBuf}; |
7 | use ra_arena::{Arena, Idx}; | ||
8 | 8 | ||
9 | use crate::utf8_stdout; | 9 | use crate::utf8_stdout; |
10 | 10 | ||
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 02c1371ac..6cbf43bb2 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -36,7 +36,7 @@ stdx = { path = "../stdx" } | |||
36 | lsp-server = "0.3.3" | 36 | lsp-server = "0.3.3" |
37 | flycheck = { path = "../flycheck" } | 37 | flycheck = { path = "../flycheck" } |
38 | ra_ide = { path = "../ra_ide" } | 38 | ra_ide = { path = "../ra_ide" } |
39 | ra_prof = { path = "../ra_prof" } | 39 | profile = { path = "../profile" } |
40 | ra_project_model = { path = "../ra_project_model" } | 40 | ra_project_model = { path = "../ra_project_model" } |
41 | ra_syntax = { path = "../ra_syntax" } | 41 | ra_syntax = { path = "../ra_syntax" } |
42 | ra_text_edit = { path = "../ra_text_edit" } | 42 | ra_text_edit = { path = "../ra_text_edit" } |
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs index fc7f8b01d..9622d71c0 100644 --- a/crates/rust-analyzer/src/bin/main.rs +++ b/crates/rust-analyzer/src/bin/main.rs | |||
@@ -55,7 +55,7 @@ fn try_main() -> Result<()> { | |||
55 | fn setup_logging() -> Result<()> { | 55 | fn setup_logging() -> Result<()> { |
56 | std::env::set_var("RUST_BACKTRACE", "short"); | 56 | std::env::set_var("RUST_BACKTRACE", "short"); |
57 | env_logger::try_init_from_env("RA_LOG")?; | 57 | env_logger::try_init_from_env("RA_LOG")?; |
58 | ra_prof::init(); | 58 | profile::init(); |
59 | Ok(()) | 59 | Ok(()) |
60 | } | 60 | } |
61 | 61 | ||
diff --git a/crates/rust-analyzer/src/cli.rs b/crates/rust-analyzer/src/cli.rs index 1034d11bd..46d70fcb2 100644 --- a/crates/rust-analyzer/src/cli.rs +++ b/crates/rust-analyzer/src/cli.rs | |||
@@ -11,7 +11,6 @@ use std::io::Read; | |||
11 | 11 | ||
12 | use anyhow::Result; | 12 | use anyhow::Result; |
13 | use ra_ide::Analysis; | 13 | use ra_ide::Analysis; |
14 | use ra_prof::profile; | ||
15 | use ra_syntax::{AstNode, SourceFile}; | 14 | use ra_syntax::{AstNode, SourceFile}; |
16 | 15 | ||
17 | pub use analysis_bench::{BenchCmd, BenchWhat, Position}; | 16 | pub use analysis_bench::{BenchCmd, BenchWhat, Position}; |
@@ -38,7 +37,7 @@ impl Verbosity { | |||
38 | } | 37 | } |
39 | 38 | ||
40 | pub fn parse(no_dump: bool) -> Result<()> { | 39 | pub fn parse(no_dump: bool) -> Result<()> { |
41 | let _p = profile("parsing"); | 40 | let _p = profile::span("parsing"); |
42 | let file = file()?; | 41 | let file = file()?; |
43 | if !no_dump { | 42 | if !no_dump { |
44 | println!("{:#?}", file.syntax()); | 43 | println!("{:#?}", file.syntax()); |
diff --git a/crates/rust-analyzer/src/cli/analysis_bench.rs b/crates/rust-analyzer/src/cli/analysis_bench.rs index c54ee5f4d..bc5f77e1a 100644 --- a/crates/rust-analyzer/src/cli/analysis_bench.rs +++ b/crates/rust-analyzer/src/cli/analysis_bench.rs | |||
@@ -52,7 +52,7 @@ impl FromStr for Position { | |||
52 | 52 | ||
53 | impl BenchCmd { | 53 | impl BenchCmd { |
54 | pub fn run(self, verbosity: Verbosity) -> Result<()> { | 54 | pub fn run(self, verbosity: Verbosity) -> Result<()> { |
55 | ra_prof::init(); | 55 | profile::init(); |
56 | 56 | ||
57 | let start = Instant::now(); | 57 | let start = Instant::now(); |
58 | eprint!("loading: "); | 58 | eprint!("loading: "); |
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs index 0d386841e..a30c1ec79 100644 --- a/crates/rust-analyzer/src/cli/analysis_stats.rs +++ b/crates/rust-analyzer/src/cli/analysis_stats.rs | |||
@@ -29,7 +29,7 @@ use crate::{ | |||
29 | }, | 29 | }, |
30 | print_memory_usage, | 30 | print_memory_usage, |
31 | }; | 31 | }; |
32 | use ra_prof::StopWatch; | 32 | use profile::StopWatch; |
33 | 33 | ||
34 | /// Need to wrap Snapshot to provide `Clone` impl for `map_with` | 34 | /// Need to wrap Snapshot to provide `Clone` impl for `map_with` |
35 | struct Snap<DB>(DB); | 35 | struct Snap<DB>(DB); |
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 658a50d15..8c115c8a6 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs | |||
@@ -27,7 +27,6 @@ use crate::{ | |||
27 | to_proto::url_from_abs_path, | 27 | to_proto::url_from_abs_path, |
28 | Result, | 28 | Result, |
29 | }; | 29 | }; |
30 | use ra_prof::profile; | ||
31 | 30 | ||
32 | #[derive(Eq, PartialEq, Copy, Clone)] | 31 | #[derive(Eq, PartialEq, Copy, Clone)] |
33 | pub(crate) enum Status { | 32 | pub(crate) enum Status { |
@@ -135,7 +134,7 @@ impl GlobalState { | |||
135 | } | 134 | } |
136 | 135 | ||
137 | pub(crate) fn process_changes(&mut self) -> bool { | 136 | pub(crate) fn process_changes(&mut self) -> bool { |
138 | let _p = profile("GlobalState::process_changes"); | 137 | let _p = profile::span("GlobalState::process_changes"); |
139 | let mut fs_changes = Vec::new(); | 138 | let mut fs_changes = Vec::new(); |
140 | let mut has_fs_changes = false; | 139 | let mut has_fs_changes = false; |
141 | 140 | ||
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 785dd2a26..d9b75eed4 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -22,7 +22,6 @@ use ra_ide::{ | |||
22 | FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query, | 22 | FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query, |
23 | RangeInfo, Runnable, RunnableKind, SearchScope, TextEdit, | 23 | RangeInfo, Runnable, RunnableKind, SearchScope, TextEdit, |
24 | }; | 24 | }; |
25 | use ra_prof::profile; | ||
26 | use ra_project_model::TargetKind; | 25 | use ra_project_model::TargetKind; |
27 | use ra_syntax::{algo, ast, AstNode, SyntaxKind, TextRange, TextSize}; | 26 | use ra_syntax::{algo, ast, AstNode, SyntaxKind, TextRange, TextSize}; |
28 | use serde::{Deserialize, Serialize}; | 27 | use serde::{Deserialize, Serialize}; |
@@ -39,7 +38,7 @@ use crate::{ | |||
39 | }; | 38 | }; |
40 | 39 | ||
41 | pub(crate) fn handle_analyzer_status(snap: GlobalStateSnapshot, _: ()) -> Result<String> { | 40 | pub(crate) fn handle_analyzer_status(snap: GlobalStateSnapshot, _: ()) -> Result<String> { |
42 | let _p = profile("handle_analyzer_status"); | 41 | let _p = profile::span("handle_analyzer_status"); |
43 | 42 | ||
44 | let mut buf = String::new(); | 43 | let mut buf = String::new(); |
45 | if snap.workspaces.is_empty() { | 44 | if snap.workspaces.is_empty() { |
@@ -64,7 +63,7 @@ pub(crate) fn handle_analyzer_status(snap: GlobalStateSnapshot, _: ()) -> Result | |||
64 | } | 63 | } |
65 | 64 | ||
66 | pub(crate) fn handle_memory_usage(state: &mut GlobalState, _: ()) -> Result<String> { | 65 | pub(crate) fn handle_memory_usage(state: &mut GlobalState, _: ()) -> Result<String> { |
67 | let _p = profile("handle_memory_usage"); | 66 | let _p = profile::span("handle_memory_usage"); |
68 | let mem = state.analysis_host.per_query_memory_usage(); | 67 | let mem = state.analysis_host.per_query_memory_usage(); |
69 | 68 | ||
70 | let mut out = String::new(); | 69 | let mut out = String::new(); |
@@ -78,7 +77,7 @@ pub(crate) fn handle_syntax_tree( | |||
78 | snap: GlobalStateSnapshot, | 77 | snap: GlobalStateSnapshot, |
79 | params: lsp_ext::SyntaxTreeParams, | 78 | params: lsp_ext::SyntaxTreeParams, |
80 | ) -> Result<String> { | 79 | ) -> Result<String> { |
81 | let _p = profile("handle_syntax_tree"); | 80 | let _p = profile::span("handle_syntax_tree"); |
82 | let id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 81 | let id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
83 | let line_index = snap.analysis.file_line_index(id)?; | 82 | let line_index = snap.analysis.file_line_index(id)?; |
84 | let text_range = params.range.map(|r| from_proto::text_range(&line_index, r)); | 83 | let text_range = params.range.map(|r| from_proto::text_range(&line_index, r)); |
@@ -90,7 +89,7 @@ pub(crate) fn handle_expand_macro( | |||
90 | snap: GlobalStateSnapshot, | 89 | snap: GlobalStateSnapshot, |
91 | params: lsp_ext::ExpandMacroParams, | 90 | params: lsp_ext::ExpandMacroParams, |
92 | ) -> Result<Option<lsp_ext::ExpandedMacro>> { | 91 | ) -> Result<Option<lsp_ext::ExpandedMacro>> { |
93 | let _p = profile("handle_expand_macro"); | 92 | let _p = profile::span("handle_expand_macro"); |
94 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 93 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
95 | let line_index = snap.analysis.file_line_index(file_id)?; | 94 | let line_index = snap.analysis.file_line_index(file_id)?; |
96 | let offset = from_proto::offset(&line_index, params.position); | 95 | let offset = from_proto::offset(&line_index, params.position); |
@@ -103,7 +102,7 @@ pub(crate) fn handle_selection_range( | |||
103 | snap: GlobalStateSnapshot, | 102 | snap: GlobalStateSnapshot, |
104 | params: lsp_types::SelectionRangeParams, | 103 | params: lsp_types::SelectionRangeParams, |
105 | ) -> Result<Option<Vec<lsp_types::SelectionRange>>> { | 104 | ) -> Result<Option<Vec<lsp_types::SelectionRange>>> { |
106 | let _p = profile("handle_selection_range"); | 105 | let _p = profile::span("handle_selection_range"); |
107 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 106 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
108 | let line_index = snap.analysis.file_line_index(file_id)?; | 107 | let line_index = snap.analysis.file_line_index(file_id)?; |
109 | let res: Result<Vec<lsp_types::SelectionRange>> = params | 108 | let res: Result<Vec<lsp_types::SelectionRange>> = params |
@@ -146,7 +145,7 @@ pub(crate) fn handle_matching_brace( | |||
146 | snap: GlobalStateSnapshot, | 145 | snap: GlobalStateSnapshot, |
147 | params: lsp_ext::MatchingBraceParams, | 146 | params: lsp_ext::MatchingBraceParams, |
148 | ) -> Result<Vec<Position>> { | 147 | ) -> Result<Vec<Position>> { |
149 | let _p = profile("handle_matching_brace"); | 148 | let _p = profile::span("handle_matching_brace"); |
150 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 149 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
151 | let line_index = snap.analysis.file_line_index(file_id)?; | 150 | let line_index = snap.analysis.file_line_index(file_id)?; |
152 | let res = params | 151 | let res = params |
@@ -168,7 +167,7 @@ pub(crate) fn handle_join_lines( | |||
168 | snap: GlobalStateSnapshot, | 167 | snap: GlobalStateSnapshot, |
169 | params: lsp_ext::JoinLinesParams, | 168 | params: lsp_ext::JoinLinesParams, |
170 | ) -> Result<Vec<lsp_types::TextEdit>> { | 169 | ) -> Result<Vec<lsp_types::TextEdit>> { |
171 | let _p = profile("handle_join_lines"); | 170 | let _p = profile::span("handle_join_lines"); |
172 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 171 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
173 | let line_index = snap.analysis.file_line_index(file_id)?; | 172 | let line_index = snap.analysis.file_line_index(file_id)?; |
174 | let line_endings = snap.file_line_endings(file_id); | 173 | let line_endings = snap.file_line_endings(file_id); |
@@ -191,7 +190,7 @@ pub(crate) fn handle_on_enter( | |||
191 | snap: GlobalStateSnapshot, | 190 | snap: GlobalStateSnapshot, |
192 | params: lsp_types::TextDocumentPositionParams, | 191 | params: lsp_types::TextDocumentPositionParams, |
193 | ) -> Result<Option<Vec<lsp_ext::SnippetTextEdit>>> { | 192 | ) -> Result<Option<Vec<lsp_ext::SnippetTextEdit>>> { |
194 | let _p = profile("handle_on_enter"); | 193 | let _p = profile::span("handle_on_enter"); |
195 | let position = from_proto::file_position(&snap, params)?; | 194 | let position = from_proto::file_position(&snap, params)?; |
196 | let edit = match snap.analysis.on_enter(position)? { | 195 | let edit = match snap.analysis.on_enter(position)? { |
197 | None => return Ok(None), | 196 | None => return Ok(None), |
@@ -208,7 +207,7 @@ pub(crate) fn handle_on_type_formatting( | |||
208 | snap: GlobalStateSnapshot, | 207 | snap: GlobalStateSnapshot, |
209 | params: lsp_types::DocumentOnTypeFormattingParams, | 208 | params: lsp_types::DocumentOnTypeFormattingParams, |
210 | ) -> Result<Option<Vec<lsp_types::TextEdit>>> { | 209 | ) -> Result<Option<Vec<lsp_types::TextEdit>>> { |
211 | let _p = profile("handle_on_type_formatting"); | 210 | let _p = profile::span("handle_on_type_formatting"); |
212 | let mut position = from_proto::file_position(&snap, params.text_document_position)?; | 211 | let mut position = from_proto::file_position(&snap, params.text_document_position)?; |
213 | let line_index = snap.analysis.file_line_index(position.file_id)?; | 212 | let line_index = snap.analysis.file_line_index(position.file_id)?; |
214 | let line_endings = snap.file_line_endings(position.file_id); | 213 | let line_endings = snap.file_line_endings(position.file_id); |
@@ -247,7 +246,7 @@ pub(crate) fn handle_document_symbol( | |||
247 | snap: GlobalStateSnapshot, | 246 | snap: GlobalStateSnapshot, |
248 | params: lsp_types::DocumentSymbolParams, | 247 | params: lsp_types::DocumentSymbolParams, |
249 | ) -> Result<Option<lsp_types::DocumentSymbolResponse>> { | 248 | ) -> Result<Option<lsp_types::DocumentSymbolResponse>> { |
250 | let _p = profile("handle_document_symbol"); | 249 | let _p = profile::span("handle_document_symbol"); |
251 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 250 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
252 | let line_index = snap.analysis.file_line_index(file_id)?; | 251 | let line_index = snap.analysis.file_line_index(file_id)?; |
253 | 252 | ||
@@ -332,7 +331,7 @@ pub(crate) fn handle_workspace_symbol( | |||
332 | snap: GlobalStateSnapshot, | 331 | snap: GlobalStateSnapshot, |
333 | params: lsp_types::WorkspaceSymbolParams, | 332 | params: lsp_types::WorkspaceSymbolParams, |
334 | ) -> Result<Option<Vec<SymbolInformation>>> { | 333 | ) -> Result<Option<Vec<SymbolInformation>>> { |
335 | let _p = profile("handle_workspace_symbol"); | 334 | let _p = profile::span("handle_workspace_symbol"); |
336 | let all_symbols = params.query.contains('#'); | 335 | let all_symbols = params.query.contains('#'); |
337 | let libs = params.query.contains('*'); | 336 | let libs = params.query.contains('*'); |
338 | let query = { | 337 | let query = { |
@@ -380,7 +379,7 @@ pub(crate) fn handle_goto_definition( | |||
380 | snap: GlobalStateSnapshot, | 379 | snap: GlobalStateSnapshot, |
381 | params: lsp_types::GotoDefinitionParams, | 380 | params: lsp_types::GotoDefinitionParams, |
382 | ) -> Result<Option<lsp_types::GotoDefinitionResponse>> { | 381 | ) -> Result<Option<lsp_types::GotoDefinitionResponse>> { |
383 | let _p = profile("handle_goto_definition"); | 382 | let _p = profile::span("handle_goto_definition"); |
384 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; | 383 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; |
385 | let nav_info = match snap.analysis.goto_definition(position)? { | 384 | let nav_info = match snap.analysis.goto_definition(position)? { |
386 | None => return Ok(None), | 385 | None => return Ok(None), |
@@ -395,7 +394,7 @@ pub(crate) fn handle_goto_implementation( | |||
395 | snap: GlobalStateSnapshot, | 394 | snap: GlobalStateSnapshot, |
396 | params: lsp_types::request::GotoImplementationParams, | 395 | params: lsp_types::request::GotoImplementationParams, |
397 | ) -> Result<Option<lsp_types::request::GotoImplementationResponse>> { | 396 | ) -> Result<Option<lsp_types::request::GotoImplementationResponse>> { |
398 | let _p = profile("handle_goto_implementation"); | 397 | let _p = profile::span("handle_goto_implementation"); |
399 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; | 398 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; |
400 | let nav_info = match snap.analysis.goto_implementation(position)? { | 399 | let nav_info = match snap.analysis.goto_implementation(position)? { |
401 | None => return Ok(None), | 400 | None => return Ok(None), |
@@ -410,7 +409,7 @@ pub(crate) fn handle_goto_type_definition( | |||
410 | snap: GlobalStateSnapshot, | 409 | snap: GlobalStateSnapshot, |
411 | params: lsp_types::request::GotoTypeDefinitionParams, | 410 | params: lsp_types::request::GotoTypeDefinitionParams, |
412 | ) -> Result<Option<lsp_types::request::GotoTypeDefinitionResponse>> { | 411 | ) -> Result<Option<lsp_types::request::GotoTypeDefinitionResponse>> { |
413 | let _p = profile("handle_goto_type_definition"); | 412 | let _p = profile::span("handle_goto_type_definition"); |
414 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; | 413 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; |
415 | let nav_info = match snap.analysis.goto_type_definition(position)? { | 414 | let nav_info = match snap.analysis.goto_type_definition(position)? { |
416 | None => return Ok(None), | 415 | None => return Ok(None), |
@@ -425,7 +424,7 @@ pub(crate) fn handle_parent_module( | |||
425 | snap: GlobalStateSnapshot, | 424 | snap: GlobalStateSnapshot, |
426 | params: lsp_types::TextDocumentPositionParams, | 425 | params: lsp_types::TextDocumentPositionParams, |
427 | ) -> Result<Option<lsp_types::GotoDefinitionResponse>> { | 426 | ) -> Result<Option<lsp_types::GotoDefinitionResponse>> { |
428 | let _p = profile("handle_parent_module"); | 427 | let _p = profile::span("handle_parent_module"); |
429 | let position = from_proto::file_position(&snap, params)?; | 428 | let position = from_proto::file_position(&snap, params)?; |
430 | let navs = snap.analysis.parent_module(position)?; | 429 | let navs = snap.analysis.parent_module(position)?; |
431 | let res = to_proto::goto_definition_response(&snap, None, navs)?; | 430 | let res = to_proto::goto_definition_response(&snap, None, navs)?; |
@@ -436,7 +435,7 @@ pub(crate) fn handle_runnables( | |||
436 | snap: GlobalStateSnapshot, | 435 | snap: GlobalStateSnapshot, |
437 | params: lsp_ext::RunnablesParams, | 436 | params: lsp_ext::RunnablesParams, |
438 | ) -> Result<Vec<lsp_ext::Runnable>> { | 437 | ) -> Result<Vec<lsp_ext::Runnable>> { |
439 | let _p = profile("handle_runnables"); | 438 | let _p = profile::span("handle_runnables"); |
440 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 439 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
441 | let line_index = snap.analysis.file_line_index(file_id)?; | 440 | let line_index = snap.analysis.file_line_index(file_id)?; |
442 | let offset = params.position.map(|it| from_proto::offset(&line_index, it)); | 441 | let offset = params.position.map(|it| from_proto::offset(&line_index, it)); |
@@ -513,7 +512,7 @@ pub(crate) fn handle_completion( | |||
513 | snap: GlobalStateSnapshot, | 512 | snap: GlobalStateSnapshot, |
514 | params: lsp_types::CompletionParams, | 513 | params: lsp_types::CompletionParams, |
515 | ) -> Result<Option<lsp_types::CompletionResponse>> { | 514 | ) -> Result<Option<lsp_types::CompletionResponse>> { |
516 | let _p = profile("handle_completion"); | 515 | let _p = profile::span("handle_completion"); |
517 | let position = from_proto::file_position(&snap, params.text_document_position)?; | 516 | let position = from_proto::file_position(&snap, params.text_document_position)?; |
518 | let completion_triggered_after_single_colon = { | 517 | let completion_triggered_after_single_colon = { |
519 | let mut res = false; | 518 | let mut res = false; |
@@ -555,7 +554,7 @@ pub(crate) fn handle_folding_range( | |||
555 | snap: GlobalStateSnapshot, | 554 | snap: GlobalStateSnapshot, |
556 | params: FoldingRangeParams, | 555 | params: FoldingRangeParams, |
557 | ) -> Result<Option<Vec<FoldingRange>>> { | 556 | ) -> Result<Option<Vec<FoldingRange>>> { |
558 | let _p = profile("handle_folding_range"); | 557 | let _p = profile::span("handle_folding_range"); |
559 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 558 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
560 | let folds = snap.analysis.folding_ranges(file_id)?; | 559 | let folds = snap.analysis.folding_ranges(file_id)?; |
561 | let text = snap.analysis.file_text(file_id)?; | 560 | let text = snap.analysis.file_text(file_id)?; |
@@ -572,7 +571,7 @@ pub(crate) fn handle_signature_help( | |||
572 | snap: GlobalStateSnapshot, | 571 | snap: GlobalStateSnapshot, |
573 | params: lsp_types::SignatureHelpParams, | 572 | params: lsp_types::SignatureHelpParams, |
574 | ) -> Result<Option<lsp_types::SignatureHelp>> { | 573 | ) -> Result<Option<lsp_types::SignatureHelp>> { |
575 | let _p = profile("handle_signature_help"); | 574 | let _p = profile::span("handle_signature_help"); |
576 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; | 575 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; |
577 | let call_info = match snap.analysis.call_info(position)? { | 576 | let call_info = match snap.analysis.call_info(position)? { |
578 | Some(it) => it, | 577 | Some(it) => it, |
@@ -591,7 +590,7 @@ pub(crate) fn handle_hover( | |||
591 | snap: GlobalStateSnapshot, | 590 | snap: GlobalStateSnapshot, |
592 | params: lsp_types::HoverParams, | 591 | params: lsp_types::HoverParams, |
593 | ) -> Result<Option<lsp_ext::Hover>> { | 592 | ) -> Result<Option<lsp_ext::Hover>> { |
594 | let _p = profile("handle_hover"); | 593 | let _p = profile::span("handle_hover"); |
595 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; | 594 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; |
596 | let info = match snap.analysis.hover(position)? { | 595 | let info = match snap.analysis.hover(position)? { |
597 | None => return Ok(None), | 596 | None => return Ok(None), |
@@ -614,7 +613,7 @@ pub(crate) fn handle_prepare_rename( | |||
614 | snap: GlobalStateSnapshot, | 613 | snap: GlobalStateSnapshot, |
615 | params: lsp_types::TextDocumentPositionParams, | 614 | params: lsp_types::TextDocumentPositionParams, |
616 | ) -> Result<Option<PrepareRenameResponse>> { | 615 | ) -> Result<Option<PrepareRenameResponse>> { |
617 | let _p = profile("handle_prepare_rename"); | 616 | let _p = profile::span("handle_prepare_rename"); |
618 | let position = from_proto::file_position(&snap, params)?; | 617 | let position = from_proto::file_position(&snap, params)?; |
619 | 618 | ||
620 | let optional_change = snap.analysis.rename(position, "dummy")?; | 619 | let optional_change = snap.analysis.rename(position, "dummy")?; |
@@ -632,7 +631,7 @@ pub(crate) fn handle_rename( | |||
632 | snap: GlobalStateSnapshot, | 631 | snap: GlobalStateSnapshot, |
633 | params: RenameParams, | 632 | params: RenameParams, |
634 | ) -> Result<Option<WorkspaceEdit>> { | 633 | ) -> Result<Option<WorkspaceEdit>> { |
635 | let _p = profile("handle_rename"); | 634 | let _p = profile::span("handle_rename"); |
636 | let position = from_proto::file_position(&snap, params.text_document_position)?; | 635 | let position = from_proto::file_position(&snap, params.text_document_position)?; |
637 | 636 | ||
638 | if params.new_name.is_empty() { | 637 | if params.new_name.is_empty() { |
@@ -656,7 +655,7 @@ pub(crate) fn handle_references( | |||
656 | snap: GlobalStateSnapshot, | 655 | snap: GlobalStateSnapshot, |
657 | params: lsp_types::ReferenceParams, | 656 | params: lsp_types::ReferenceParams, |
658 | ) -> Result<Option<Vec<Location>>> { | 657 | ) -> Result<Option<Vec<Location>>> { |
659 | let _p = profile("handle_references"); | 658 | let _p = profile::span("handle_references"); |
660 | let position = from_proto::file_position(&snap, params.text_document_position)?; | 659 | let position = from_proto::file_position(&snap, params.text_document_position)?; |
661 | 660 | ||
662 | let refs = match snap.analysis.find_all_refs(position, None)? { | 661 | let refs = match snap.analysis.find_all_refs(position, None)? { |
@@ -683,7 +682,7 @@ pub(crate) fn handle_formatting( | |||
683 | snap: GlobalStateSnapshot, | 682 | snap: GlobalStateSnapshot, |
684 | params: DocumentFormattingParams, | 683 | params: DocumentFormattingParams, |
685 | ) -> Result<Option<Vec<lsp_types::TextEdit>>> { | 684 | ) -> Result<Option<Vec<lsp_types::TextEdit>>> { |
686 | let _p = profile("handle_formatting"); | 685 | let _p = profile::span("handle_formatting"); |
687 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 686 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
688 | let file = snap.analysis.file_text(file_id)?; | 687 | let file = snap.analysis.file_text(file_id)?; |
689 | let crate_ids = snap.analysis.crate_for(file_id)?; | 688 | let crate_ids = snap.analysis.crate_for(file_id)?; |
@@ -805,7 +804,7 @@ pub(crate) fn handle_code_action( | |||
805 | mut snap: GlobalStateSnapshot, | 804 | mut snap: GlobalStateSnapshot, |
806 | params: lsp_types::CodeActionParams, | 805 | params: lsp_types::CodeActionParams, |
807 | ) -> Result<Option<Vec<lsp_ext::CodeAction>>> { | 806 | ) -> Result<Option<Vec<lsp_ext::CodeAction>>> { |
808 | let _p = profile("handle_code_action"); | 807 | let _p = profile::span("handle_code_action"); |
809 | // We intentionally don't support command-based actions, as those either | 808 | // We intentionally don't support command-based actions, as those either |
810 | // requires custom client-code anyway, or requires server-initiated edits. | 809 | // requires custom client-code anyway, or requires server-initiated edits. |
811 | // Server initiated edits break causality, so we avoid those as well. | 810 | // Server initiated edits break causality, so we avoid those as well. |
@@ -847,7 +846,7 @@ pub(crate) fn handle_resolve_code_action( | |||
847 | mut snap: GlobalStateSnapshot, | 846 | mut snap: GlobalStateSnapshot, |
848 | params: lsp_ext::ResolveCodeActionParams, | 847 | params: lsp_ext::ResolveCodeActionParams, |
849 | ) -> Result<Option<lsp_ext::SnippetWorkspaceEdit>> { | 848 | ) -> Result<Option<lsp_ext::SnippetWorkspaceEdit>> { |
850 | let _p = profile("handle_resolve_code_action"); | 849 | let _p = profile::span("handle_resolve_code_action"); |
851 | let file_id = from_proto::file_id(&snap, ¶ms.code_action_params.text_document.uri)?; | 850 | let file_id = from_proto::file_id(&snap, ¶ms.code_action_params.text_document.uri)?; |
852 | let line_index = snap.analysis.file_line_index(file_id)?; | 851 | let line_index = snap.analysis.file_line_index(file_id)?; |
853 | let range = from_proto::text_range(&line_index, params.code_action_params.range); | 852 | let range = from_proto::text_range(&line_index, params.code_action_params.range); |
@@ -871,7 +870,7 @@ pub(crate) fn handle_code_lens( | |||
871 | snap: GlobalStateSnapshot, | 870 | snap: GlobalStateSnapshot, |
872 | params: lsp_types::CodeLensParams, | 871 | params: lsp_types::CodeLensParams, |
873 | ) -> Result<Option<Vec<CodeLens>>> { | 872 | ) -> Result<Option<Vec<CodeLens>>> { |
874 | let _p = profile("handle_code_lens"); | 873 | let _p = profile::span("handle_code_lens"); |
875 | let mut lenses: Vec<CodeLens> = Default::default(); | 874 | let mut lenses: Vec<CodeLens> = Default::default(); |
876 | 875 | ||
877 | if snap.config.lens.none() { | 876 | if snap.config.lens.none() { |
@@ -957,7 +956,7 @@ pub(crate) fn handle_code_lens_resolve( | |||
957 | snap: GlobalStateSnapshot, | 956 | snap: GlobalStateSnapshot, |
958 | code_lens: CodeLens, | 957 | code_lens: CodeLens, |
959 | ) -> Result<CodeLens> { | 958 | ) -> Result<CodeLens> { |
960 | let _p = profile("handle_code_lens_resolve"); | 959 | let _p = profile::span("handle_code_lens_resolve"); |
961 | let data = code_lens.data.unwrap(); | 960 | let data = code_lens.data.unwrap(); |
962 | let resolve = from_json::<Option<CodeLensResolveData>>("CodeLensResolveData", data)?; | 961 | let resolve = from_json::<Option<CodeLensResolveData>>("CodeLensResolveData", data)?; |
963 | match resolve { | 962 | match resolve { |
@@ -994,7 +993,7 @@ pub(crate) fn handle_document_highlight( | |||
994 | snap: GlobalStateSnapshot, | 993 | snap: GlobalStateSnapshot, |
995 | params: lsp_types::DocumentHighlightParams, | 994 | params: lsp_types::DocumentHighlightParams, |
996 | ) -> Result<Option<Vec<DocumentHighlight>>> { | 995 | ) -> Result<Option<Vec<DocumentHighlight>>> { |
997 | let _p = profile("handle_document_highlight"); | 996 | let _p = profile::span("handle_document_highlight"); |
998 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; | 997 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; |
999 | let line_index = snap.analysis.file_line_index(position.file_id)?; | 998 | let line_index = snap.analysis.file_line_index(position.file_id)?; |
1000 | 999 | ||
@@ -1021,7 +1020,7 @@ pub(crate) fn handle_ssr( | |||
1021 | snap: GlobalStateSnapshot, | 1020 | snap: GlobalStateSnapshot, |
1022 | params: lsp_ext::SsrParams, | 1021 | params: lsp_ext::SsrParams, |
1023 | ) -> Result<lsp_types::WorkspaceEdit> { | 1022 | ) -> Result<lsp_types::WorkspaceEdit> { |
1024 | let _p = profile("handle_ssr"); | 1023 | let _p = profile::span("handle_ssr"); |
1025 | let selections = params | 1024 | let selections = params |
1026 | .selections | 1025 | .selections |
1027 | .iter() | 1026 | .iter() |
@@ -1041,7 +1040,7 @@ pub(crate) fn publish_diagnostics( | |||
1041 | snap: &GlobalStateSnapshot, | 1040 | snap: &GlobalStateSnapshot, |
1042 | file_id: FileId, | 1041 | file_id: FileId, |
1043 | ) -> Result<Vec<Diagnostic>> { | 1042 | ) -> Result<Vec<Diagnostic>> { |
1044 | let _p = profile("publish_diagnostics"); | 1043 | let _p = profile::span("publish_diagnostics"); |
1045 | let line_index = snap.analysis.file_line_index(file_id)?; | 1044 | let line_index = snap.analysis.file_line_index(file_id)?; |
1046 | let diagnostics: Vec<Diagnostic> = snap | 1045 | let diagnostics: Vec<Diagnostic> = snap |
1047 | .analysis | 1046 | .analysis |
@@ -1064,7 +1063,7 @@ pub(crate) fn handle_inlay_hints( | |||
1064 | snap: GlobalStateSnapshot, | 1063 | snap: GlobalStateSnapshot, |
1065 | params: InlayHintsParams, | 1064 | params: InlayHintsParams, |
1066 | ) -> Result<Vec<InlayHint>> { | 1065 | ) -> Result<Vec<InlayHint>> { |
1067 | let _p = profile("handle_inlay_hints"); | 1066 | let _p = profile::span("handle_inlay_hints"); |
1068 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 1067 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
1069 | let line_index = snap.analysis.file_line_index(file_id)?; | 1068 | let line_index = snap.analysis.file_line_index(file_id)?; |
1070 | Ok(snap | 1069 | Ok(snap |
@@ -1079,7 +1078,7 @@ pub(crate) fn handle_call_hierarchy_prepare( | |||
1079 | snap: GlobalStateSnapshot, | 1078 | snap: GlobalStateSnapshot, |
1080 | params: CallHierarchyPrepareParams, | 1079 | params: CallHierarchyPrepareParams, |
1081 | ) -> Result<Option<Vec<CallHierarchyItem>>> { | 1080 | ) -> Result<Option<Vec<CallHierarchyItem>>> { |
1082 | let _p = profile("handle_call_hierarchy_prepare"); | 1081 | let _p = profile::span("handle_call_hierarchy_prepare"); |
1083 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; | 1082 | let position = from_proto::file_position(&snap, params.text_document_position_params)?; |
1084 | 1083 | ||
1085 | let nav_info = match snap.analysis.call_hierarchy(position)? { | 1084 | let nav_info = match snap.analysis.call_hierarchy(position)? { |
@@ -1101,7 +1100,7 @@ pub(crate) fn handle_call_hierarchy_incoming( | |||
1101 | snap: GlobalStateSnapshot, | 1100 | snap: GlobalStateSnapshot, |
1102 | params: CallHierarchyIncomingCallsParams, | 1101 | params: CallHierarchyIncomingCallsParams, |
1103 | ) -> Result<Option<Vec<CallHierarchyIncomingCall>>> { | 1102 | ) -> Result<Option<Vec<CallHierarchyIncomingCall>>> { |
1104 | let _p = profile("handle_call_hierarchy_incoming"); | 1103 | let _p = profile::span("handle_call_hierarchy_incoming"); |
1105 | let item = params.item; | 1104 | let item = params.item; |
1106 | 1105 | ||
1107 | let doc = TextDocumentIdentifier::new(item.uri); | 1106 | let doc = TextDocumentIdentifier::new(item.uri); |
@@ -1136,7 +1135,7 @@ pub(crate) fn handle_call_hierarchy_outgoing( | |||
1136 | snap: GlobalStateSnapshot, | 1135 | snap: GlobalStateSnapshot, |
1137 | params: CallHierarchyOutgoingCallsParams, | 1136 | params: CallHierarchyOutgoingCallsParams, |
1138 | ) -> Result<Option<Vec<CallHierarchyOutgoingCall>>> { | 1137 | ) -> Result<Option<Vec<CallHierarchyOutgoingCall>>> { |
1139 | let _p = profile("handle_call_hierarchy_outgoing"); | 1138 | let _p = profile::span("handle_call_hierarchy_outgoing"); |
1140 | let item = params.item; | 1139 | let item = params.item; |
1141 | 1140 | ||
1142 | let doc = TextDocumentIdentifier::new(item.uri); | 1141 | let doc = TextDocumentIdentifier::new(item.uri); |
@@ -1171,7 +1170,7 @@ pub(crate) fn handle_semantic_tokens( | |||
1171 | snap: GlobalStateSnapshot, | 1170 | snap: GlobalStateSnapshot, |
1172 | params: SemanticTokensParams, | 1171 | params: SemanticTokensParams, |
1173 | ) -> Result<Option<SemanticTokensResult>> { | 1172 | ) -> Result<Option<SemanticTokensResult>> { |
1174 | let _p = profile("handle_semantic_tokens"); | 1173 | let _p = profile::span("handle_semantic_tokens"); |
1175 | 1174 | ||
1176 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 1175 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
1177 | let text = snap.analysis.file_text(file_id)?; | 1176 | let text = snap.analysis.file_text(file_id)?; |
@@ -1190,7 +1189,7 @@ pub(crate) fn handle_semantic_tokens_edits( | |||
1190 | snap: GlobalStateSnapshot, | 1189 | snap: GlobalStateSnapshot, |
1191 | params: SemanticTokensEditsParams, | 1190 | params: SemanticTokensEditsParams, |
1192 | ) -> Result<Option<SemanticTokensEditResult>> { | 1191 | ) -> Result<Option<SemanticTokensEditResult>> { |
1193 | let _p = profile("handle_semantic_tokens_edits"); | 1192 | let _p = profile::span("handle_semantic_tokens_edits"); |
1194 | 1193 | ||
1195 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 1194 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
1196 | let text = snap.analysis.file_text(file_id)?; | 1195 | let text = snap.analysis.file_text(file_id)?; |
@@ -1220,7 +1219,7 @@ pub(crate) fn handle_semantic_tokens_range( | |||
1220 | snap: GlobalStateSnapshot, | 1219 | snap: GlobalStateSnapshot, |
1221 | params: SemanticTokensRangeParams, | 1220 | params: SemanticTokensRangeParams, |
1222 | ) -> Result<Option<SemanticTokensRangeResult>> { | 1221 | ) -> Result<Option<SemanticTokensRangeResult>> { |
1223 | let _p = profile("handle_semantic_tokens_range"); | 1222 | let _p = profile::span("handle_semantic_tokens_range"); |
1224 | 1223 | ||
1225 | let frange = from_proto::file_range(&snap, params.text_document, params.range)?; | 1224 | let frange = from_proto::file_range(&snap, params.text_document, params.range)?; |
1226 | let text = snap.analysis.file_text(frange.file_id)?; | 1225 | let text = snap.analysis.file_text(frange.file_id)?; |
diff --git a/crates/rust-analyzer/src/lib.rs b/crates/rust-analyzer/src/lib.rs index ed37992cd..8d2e76cc2 100644 --- a/crates/rust-analyzer/src/lib.rs +++ b/crates/rust-analyzer/src/lib.rs | |||
@@ -74,16 +74,16 @@ impl std::error::Error for LspError {} | |||
74 | fn print_memory_usage(mut host: AnalysisHost, vfs: Vfs) { | 74 | fn print_memory_usage(mut host: AnalysisHost, vfs: Vfs) { |
75 | let mut mem = host.per_query_memory_usage(); | 75 | let mut mem = host.per_query_memory_usage(); |
76 | 76 | ||
77 | let before = ra_prof::memory_usage(); | 77 | let before = profile::memory_usage(); |
78 | drop(vfs); | 78 | drop(vfs); |
79 | let vfs = before.allocated - ra_prof::memory_usage().allocated; | 79 | let vfs = before.allocated - profile::memory_usage().allocated; |
80 | mem.push(("VFS".into(), vfs)); | 80 | mem.push(("VFS".into(), vfs)); |
81 | 81 | ||
82 | let before = ra_prof::memory_usage(); | 82 | let before = profile::memory_usage(); |
83 | drop(host); | 83 | drop(host); |
84 | mem.push(("Unaccounted".into(), before.allocated - ra_prof::memory_usage().allocated)); | 84 | mem.push(("Unaccounted".into(), before.allocated - profile::memory_usage().allocated)); |
85 | 85 | ||
86 | mem.push(("Remaining".into(), ra_prof::memory_usage().allocated)); | 86 | mem.push(("Remaining".into(), profile::memory_usage().allocated)); |
87 | 87 | ||
88 | for (name, bytes) in mem { | 88 | for (name, bytes) in mem { |
89 | eprintln!("{:>8} {}", bytes, name); | 89 | eprintln!("{:>8} {}", bytes, name); |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index e6cf46df2..32962b088 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -10,7 +10,6 @@ use lsp_server::{Connection, Notification, Request, Response}; | |||
10 | use lsp_types::notification::Notification as _; | 10 | use lsp_types::notification::Notification as _; |
11 | use ra_db::VfsPath; | 11 | use ra_db::VfsPath; |
12 | use ra_ide::{Canceled, FileId}; | 12 | use ra_ide::{Canceled, FileId}; |
13 | use ra_prof::profile; | ||
14 | 13 | ||
15 | use crate::{ | 14 | use crate::{ |
16 | config::Config, | 15 | config::Config, |
@@ -173,7 +172,7 @@ impl GlobalState { | |||
173 | fn handle_event(&mut self, event: Event) -> Result<()> { | 172 | fn handle_event(&mut self, event: Event) -> Result<()> { |
174 | let loop_start = Instant::now(); | 173 | let loop_start = Instant::now(); |
175 | // NOTE: don't count blocking select! call as a loop-turn time | 174 | // NOTE: don't count blocking select! call as a loop-turn time |
176 | let _p = profile("GlobalState::handle_event"); | 175 | let _p = profile::span("GlobalState::handle_event"); |
177 | 176 | ||
178 | log::info!("handle_event({:?})", event); | 177 | log::info!("handle_event({:?})", event); |
179 | let queue_count = self.task_pool.handle.len(); | 178 | let queue_count = self.task_pool.handle.len(); |
@@ -204,7 +203,7 @@ impl GlobalState { | |||
204 | self.analysis_host.maybe_collect_garbage(); | 203 | self.analysis_host.maybe_collect_garbage(); |
205 | } | 204 | } |
206 | Event::Vfs(mut task) => { | 205 | Event::Vfs(mut task) => { |
207 | let _p = profile("GlobalState::handle_event/vfs"); | 206 | let _p = profile::span("GlobalState::handle_event/vfs"); |
208 | loop { | 207 | loop { |
209 | match task { | 208 | match task { |
210 | vfs::loader::Message::Loaded { files } => { | 209 | vfs::loader::Message::Loaded { files } => { |
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index 1907f2f13..f74f2c02c 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs | |||
@@ -4,7 +4,6 @@ use std::{mem, sync::Arc}; | |||
4 | use flycheck::FlycheckHandle; | 4 | use flycheck::FlycheckHandle; |
5 | use ra_db::{CrateGraph, SourceRoot, VfsPath}; | 5 | use ra_db::{CrateGraph, SourceRoot, VfsPath}; |
6 | use ra_ide::AnalysisChange; | 6 | use ra_ide::AnalysisChange; |
7 | use ra_prof::profile; | ||
8 | use ra_project_model::{ProcMacroClient, ProjectWorkspace}; | 7 | use ra_project_model::{ProcMacroClient, ProjectWorkspace}; |
9 | use vfs::{file_set::FileSetConfig, AbsPath, AbsPathBuf, ChangeKind}; | 8 | use vfs::{file_set::FileSetConfig, AbsPath, AbsPathBuf, ChangeKind}; |
10 | 9 | ||
@@ -17,7 +16,7 @@ use crate::{ | |||
17 | 16 | ||
18 | impl GlobalState { | 17 | impl GlobalState { |
19 | pub(crate) fn update_configuration(&mut self, config: Config) { | 18 | pub(crate) fn update_configuration(&mut self, config: Config) { |
20 | let _p = profile("GlobalState::update_configuration"); | 19 | let _p = profile::span("GlobalState::update_configuration"); |
21 | let old_config = mem::replace(&mut self.config, config); | 20 | let old_config = mem::replace(&mut self.config, config); |
22 | if self.config.lru_capacity != old_config.lru_capacity { | 21 | if self.config.lru_capacity != old_config.lru_capacity { |
23 | self.analysis_host.update_lru_capacity(old_config.lru_capacity); | 22 | self.analysis_host.update_lru_capacity(old_config.lru_capacity); |
@@ -115,7 +114,7 @@ impl GlobalState { | |||
115 | }); | 114 | }); |
116 | } | 115 | } |
117 | pub(crate) fn switch_workspaces(&mut self, workspaces: Vec<anyhow::Result<ProjectWorkspace>>) { | 116 | pub(crate) fn switch_workspaces(&mut self, workspaces: Vec<anyhow::Result<ProjectWorkspace>>) { |
118 | let _p = profile("GlobalState::switch_workspaces"); | 117 | let _p = profile::span("GlobalState::switch_workspaces"); |
119 | log::info!("reloading projects: {:?}", self.config.linked_projects); | 118 | log::info!("reloading projects: {:?}", self.config.linked_projects); |
120 | 119 | ||
121 | let mut has_errors = false; | 120 | let mut has_errors = false; |
@@ -300,7 +299,7 @@ pub(crate) struct SourceRootConfig { | |||
300 | 299 | ||
301 | impl SourceRootConfig { | 300 | impl SourceRootConfig { |
302 | pub(crate) fn partition(&self, vfs: &vfs::Vfs) -> Vec<SourceRoot> { | 301 | pub(crate) fn partition(&self, vfs: &vfs::Vfs) -> Vec<SourceRoot> { |
303 | let _p = profile("SourceRootConfig::partition"); | 302 | let _p = profile::span("SourceRootConfig::partition"); |
304 | self.fsc | 303 | self.fsc |
305 | .partition(vfs) | 304 | .partition(vfs) |
306 | .into_iter() | 305 | .into_iter() |
diff --git a/crates/rust-analyzer/tests/heavy_tests/support.rs b/crates/rust-analyzer/tests/heavy_tests/support.rs index f242c8165..15866fbb1 100644 --- a/crates/rust-analyzer/tests/heavy_tests/support.rs +++ b/crates/rust-analyzer/tests/heavy_tests/support.rs | |||
@@ -62,7 +62,7 @@ impl<'a> Project<'a> { | |||
62 | static INIT: Once = Once::new(); | 62 | static INIT: Once = Once::new(); |
63 | INIT.call_once(|| { | 63 | INIT.call_once(|| { |
64 | env_logger::builder().is_test(true).try_init().unwrap(); | 64 | env_logger::builder().is_test(true).try_init().unwrap(); |
65 | ra_prof::init_from(crate::PROFILE); | 65 | profile::init_from(crate::PROFILE); |
66 | }); | 66 | }); |
67 | 67 | ||
68 | for entry in Fixture::parse(self.fixture) { | 68 | for entry in Fixture::parse(self.fixture) { |