aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-08-12 15:36:01 +0100
committerGitHub <[email protected]>2020-08-12 15:36:01 +0100
commit147547e7b85e80e2e30aa1a5ba4d9d0969908398 (patch)
treec39749d1b71b73b4017c2d0d848ebdc85e570c39 /crates/ra_hir_ty
parent6be5ab02008b442c85c201968b97f24f13c4692e (diff)
parent208b7bd7ba687fb570feb1b89219f14c63712ce8 (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/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/Cargo.toml4
-rw-r--r--crates/ra_hir_ty/src/db.rs5
-rw-r--r--crates/ra_hir_ty/src/diagnostics.rs3
-rw-r--r--crates/ra_hir_ty/src/diagnostics/match_check.rs2
-rw-r--r--crates/ra_hir_ty/src/infer.rs5
-rw-r--r--crates/ra_hir_ty/src/lower.rs2
-rw-r--r--crates/ra_hir_ty/src/method_resolution.rs5
-rw-r--r--crates/ra_hir_ty/src/traits.rs3
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs2
9 files changed, 13 insertions, 18 deletions
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
21hir_def = { path = "../ra_hir_def", package = "ra_hir_def" } 21hir_def = { path = "../ra_hir_def", package = "ra_hir_def" }
22hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } 22hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" }
23ra_arena = { path = "../ra_arena" } 23arena = { path = "../arena" }
24ra_db = { path = "../ra_db" } 24ra_db = { path = "../ra_db" }
25ra_prof = { path = "../ra_prof" } 25profile = { path = "../profile" }
26ra_syntax = { path = "../ra_syntax" } 26ra_syntax = { path = "../ra_syntax" }
27test_utils = { path = "../test_utils" } 27test_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
3use std::sync::Arc; 3use std::sync::Arc;
4 4
5use arena::map::ArenaMap;
5use hir_def::{ 6use 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};
9use ra_arena::map::ArenaMap;
10use ra_db::{impl_intern_key, salsa, CrateId, Upcast}; 10use ra_db::{impl_intern_key, salsa, CrateId, Upcast};
11use ra_prof::profile;
12 11
13use crate::{ 12use 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
125fn infer_wait(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { 124fn 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;
8use hir_def::DefWithBodyId; 8use hir_def::DefWithBodyId;
9use hir_expand::diagnostics::{Diagnostic, DiagnosticSink}; 9use hir_expand::diagnostics::{Diagnostic, DiagnosticSink};
10use hir_expand::{name::Name, HirFileId, InFile}; 10use hir_expand::{name::Name, HirFileId, InFile};
11use ra_prof::profile;
12use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; 11use ra_syntax::{ast, AstPtr, SyntaxNodePtr};
13use stdx::format_to; 12use stdx::format_to;
14 13
@@ -17,7 +16,7 @@ use crate::db::HirDatabase;
17pub use crate::diagnostics::expr::{record_literal_missing_fields, record_pattern_missing_fields}; 16pub use crate::diagnostics::expr::{record_literal_missing_fields, record_pattern_missing_fields};
18 17
19pub fn validate_body(db: &dyn HirDatabase, owner: DefWithBodyId, sink: &mut DiagnosticSink<'_>) { 18pub 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//! ```
219use std::sync::Arc; 219use std::sync::Arc;
220 220
221use arena::Idx;
221use hir_def::{ 222use 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};
227use ra_arena::Idx;
228use smallvec::{smallvec, SmallVec}; 228use smallvec::{smallvec, SmallVec};
229 229
230use crate::{db::HirDatabase, ApplicationTy, InferenceResult, Ty, TypeCtor}; 230use 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;
18use std::ops::Index; 18use std::ops::Index;
19use std::sync::Arc; 19use std::sync::Arc;
20 20
21use arena::map::ArenaMap;
21use hir_def::{ 22use 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};
32use hir_expand::{diagnostics::DiagnosticSink, name::name}; 33use hir_expand::{diagnostics::DiagnosticSink, name::name};
33use ra_arena::map::ArenaMap;
34use ra_prof::profile;
35use ra_syntax::SmolStr; 34use ra_syntax::SmolStr;
36use rustc_hash::FxHashMap; 35use rustc_hash::FxHashMap;
37use stdx::impl_from; 36use 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.
66pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { 65pub(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.
8use std::{iter, sync::Arc}; 8use std::{iter, sync::Arc};
9 9
10use arena::map::ArenaMap;
10use hir_def::{ 11use 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};
21use hir_expand::name::Name; 22use hir_expand::name::Name;
22use ra_arena::map::ArenaMap;
23use ra_db::CrateId; 23use ra_db::CrateId;
24use smallvec::SmallVec; 24use smallvec::SmallVec;
25use stdx::impl_from; 25use 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};
14use hir_expand::name::Name; 14use hir_expand::name::Name;
15use ra_db::CrateId; 15use ra_db::CrateId;
16use ra_prof::profile;
17use rustc_hash::{FxHashMap, FxHashSet}; 16use rustc_hash::{FxHashMap, FxHashSet};
18 17
19use super::Substs; 18use super::Substs;
@@ -109,7 +108,7 @@ pub struct TraitImpls {
109 108
110impl TraitImpls { 109impl 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;
5use chalk_solve::Solver; 5use chalk_solve::Solver;
6use hir_def::{lang_item::LangItemTarget, TraitId}; 6use hir_def::{lang_item::LangItemTarget, TraitId};
7use ra_db::CrateId; 7use ra_db::CrateId;
8use ra_prof::profile;
9 8
10use crate::{db::HirDatabase, DebruijnIndex, Substs}; 9use 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_)