diff options
-rw-r--r-- | Cargo.lock | 8 | ||||
-rw-r--r-- | crates/ra_cargo_watch/src/conv/test.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/db.rs | 18 | ||||
-rw-r--r-- | crates/ra_hir_def/src/db.rs | 11 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/db.rs | 11 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/infer.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/lower.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/regression.rs | 17 | ||||
-rw-r--r-- | crates/ra_ide/src/change.rs | 6 |
13 files changed, 64 insertions, 25 deletions
diff --git a/Cargo.lock b/Cargo.lock index 2d1856d99..9187a913b 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -442,7 +442,7 @@ name = "humantime" | |||
442 | version = "1.3.0" | 442 | version = "1.3.0" |
443 | source = "registry+https://github.com/rust-lang/crates.io-index" | 443 | source = "registry+https://github.com/rust-lang/crates.io-index" |
444 | dependencies = [ | 444 | dependencies = [ |
445 | "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | 445 | "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", |
446 | ] | 446 | ] |
447 | 447 | ||
448 | [[package]] | 448 | [[package]] |
@@ -836,7 +836,7 @@ dependencies = [ | |||
836 | "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", | 836 | "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", |
837 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | 837 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", |
838 | "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", | 838 | "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", |
839 | "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | 839 | "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", |
840 | "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", | 840 | "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", |
841 | "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | 841 | "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", |
842 | "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | 842 | "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -845,7 +845,7 @@ dependencies = [ | |||
845 | 845 | ||
846 | [[package]] | 846 | [[package]] |
847 | name = "quick-error" | 847 | name = "quick-error" |
848 | version = "1.2.2" | 848 | version = "1.2.3" |
849 | source = "registry+https://github.com/rust-lang/crates.io-index" | 849 | source = "registry+https://github.com/rust-lang/crates.io-index" |
850 | 850 | ||
851 | [[package]] | 851 | [[package]] |
@@ -1868,7 +1868,7 @@ dependencies = [ | |||
1868 | "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" | 1868 | "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" |
1869 | "checksum proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0319972dcae462681daf4da1adeeaa066e3ebd29c69be96c6abb1259d2ee2bcc" | 1869 | "checksum proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0319972dcae462681daf4da1adeeaa066e3ebd29c69be96c6abb1259d2ee2bcc" |
1870 | "checksum proptest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf147e022eacf0c8a054ab864914a7602618adba841d800a9a9868a5237a529f" | 1870 | "checksum proptest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf147e022eacf0c8a054ab864914a7602618adba841d800a9a9868a5237a529f" |
1871 | "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" | 1871 | "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" |
1872 | "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" | 1872 | "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" |
1873 | "checksum ra_vfs 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bc898f237e4b4498959ae0100c688793a23e77624d44ef710ba70094217f98e0" | 1873 | "checksum ra_vfs 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bc898f237e4b4498959ae0100c688793a23e77624d44ef710ba70094217f98e0" |
1874 | "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" | 1874 | "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" |
diff --git a/crates/ra_cargo_watch/src/conv/test.rs b/crates/ra_cargo_watch/src/conv/test.rs index f77ef1b4d..6b86525b8 100644 --- a/crates/ra_cargo_watch/src/conv/test.rs +++ b/crates/ra_cargo_watch/src/conv/test.rs | |||
@@ -1,7 +1,9 @@ | |||
1 | //! This module contains the large and verbose snapshot tests for the | 1 | //! This module contains the large and verbose snapshot tests for the |
2 | //! conversions between `cargo check` json and LSP diagnostics. | 2 | //! conversions between `cargo check` json and LSP diagnostics. |
3 | #[cfg(not(windows))] | ||
3 | use crate::*; | 4 | use crate::*; |
4 | 5 | ||
6 | #[cfg(not(windows))] | ||
5 | fn parse_diagnostic(val: &str) -> cargo_metadata::diagnostic::Diagnostic { | 7 | fn parse_diagnostic(val: &str) -> cargo_metadata::diagnostic::Diagnostic { |
6 | serde_json::from_str::<cargo_metadata::diagnostic::Diagnostic>(val).unwrap() | 8 | serde_json::from_str::<cargo_metadata::diagnostic::Diagnostic>(val).unwrap() |
7 | } | 9 | } |
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 488f74cfb..cc42068a1 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -25,6 +25,7 @@ use hir_ty::{ | |||
25 | TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk, | 25 | TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk, |
26 | }; | 26 | }; |
27 | use ra_db::{CrateId, Edition, FileId}; | 27 | use ra_db::{CrateId, Edition, FileId}; |
28 | use ra_prof::profile; | ||
28 | use ra_syntax::ast; | 29 | use ra_syntax::ast; |
29 | 30 | ||
30 | use crate::{ | 31 | use crate::{ |
@@ -189,6 +190,7 @@ impl Module { | |||
189 | } | 190 | } |
190 | 191 | ||
191 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { | 192 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { |
193 | let _p = profile("Module::diagnostics"); | ||
192 | db.crate_def_map(self.id.krate).add_diagnostics(db, self.id.local_id, sink); | 194 | db.crate_def_map(self.id.krate).add_diagnostics(db, self.id.local_id, sink); |
193 | for decl in self.declarations(db) { | 195 | for decl in self.declarations(db) { |
194 | match decl { | 196 | match decl { |
@@ -507,6 +509,7 @@ impl Function { | |||
507 | } | 509 | } |
508 | 510 | ||
509 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { | 511 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { |
512 | let _p = profile("Function::diagnostics"); | ||
510 | let infer = db.infer(self.id.into()); | 513 | let infer = db.infer(self.id.into()); |
511 | infer.add_diagnostics(db, self.id, sink); | 514 | infer.add_diagnostics(db, self.id, sink); |
512 | let mut validator = ExprValidator::new(self.id, infer, sink); | 515 | let mut validator = ExprValidator::new(self.id, infer, sink); |
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index f5ffd64fa..e6079b88d 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -1,21 +1,21 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | pub use hir_def::db::{ | 3 | pub use hir_def::db::{ |
4 | BodyQuery, BodyWithSourceMapQuery, ConstDataQuery, CrateDefMapQuery, CrateLangItemsQuery, | 4 | BodyQuery, BodyWithSourceMapQuery, ComputeCrateDefMapQuery, ConstDataQuery, |
5 | DefDatabase, DefDatabaseStorage, DocumentationQuery, EnumDataQuery, ExprScopesQuery, | 5 | CrateLangItemsQuery, DefDatabase, DefDatabaseStorage, DocumentationQuery, EnumDataQuery, |
6 | FunctionDataQuery, GenericParamsQuery, ImplDataQuery, InternDatabase, InternDatabaseStorage, | 6 | ExprScopesQuery, FunctionDataQuery, GenericParamsQuery, ImplDataQuery, InternDatabase, |
7 | LangItemQuery, ModuleLangItemsQuery, RawItemsQuery, StaticDataQuery, StructDataQuery, | 7 | InternDatabaseStorage, LangItemQuery, ModuleLangItemsQuery, RawItemsQuery, StaticDataQuery, |
8 | TraitDataQuery, TypeAliasDataQuery, | 8 | StructDataQuery, TraitDataQuery, TypeAliasDataQuery, |
9 | }; | 9 | }; |
10 | pub use hir_expand::db::{ | 10 | pub use hir_expand::db::{ |
11 | AstDatabase, AstDatabaseStorage, AstIdMapQuery, MacroArgQuery, MacroDefQuery, MacroExpandQuery, | 11 | AstDatabase, AstDatabaseStorage, AstIdMapQuery, MacroArgQuery, MacroDefQuery, MacroExpandQuery, |
12 | ParseMacroQuery, | 12 | ParseMacroQuery, |
13 | }; | 13 | }; |
14 | pub use hir_ty::db::{ | 14 | pub use hir_ty::db::{ |
15 | AssociatedTyDataQuery, CallableItemSignatureQuery, FieldTypesQuery, GenericDefaultsQuery, | 15 | AssociatedTyDataQuery, CallableItemSignatureQuery, DoInferQuery, FieldTypesQuery, |
16 | GenericPredicatesQuery, HirDatabase, HirDatabaseStorage, ImplDatumQuery, ImplsForTraitQuery, | 16 | GenericDefaultsQuery, GenericPredicatesQuery, HirDatabase, HirDatabaseStorage, ImplDatumQuery, |
17 | ImplsInCrateQuery, InferQuery, StructDatumQuery, TraitDatumQuery, TraitSolveQuery, TyQuery, | 17 | ImplsForTraitQuery, ImplsInCrateQuery, StructDatumQuery, TraitDatumQuery, TraitSolveQuery, |
18 | ValueTyQuery, | 18 | TyQuery, ValueTyQuery, |
19 | }; | 19 | }; |
20 | 20 | ||
21 | #[test] | 21 | #[test] |
diff --git a/crates/ra_hir_def/src/db.rs b/crates/ra_hir_def/src/db.rs index c55fd4111..da273eb11 100644 --- a/crates/ra_hir_def/src/db.rs +++ b/crates/ra_hir_def/src/db.rs | |||
@@ -3,6 +3,7 @@ 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}; | 5 | use ra_db::{salsa, CrateId, SourceDatabase}; |
6 | use ra_prof::profile; | ||
6 | use ra_syntax::SmolStr; | 7 | use ra_syntax::SmolStr; |
7 | 8 | ||
8 | use crate::{ | 9 | use crate::{ |
@@ -46,9 +47,12 @@ pub trait DefDatabase: InternDatabase + AstDatabase { | |||
46 | #[salsa::invoke(RawItems::raw_items_query)] | 47 | #[salsa::invoke(RawItems::raw_items_query)] |
47 | fn raw_items(&self, file_id: HirFileId) -> Arc<RawItems>; | 48 | fn raw_items(&self, file_id: HirFileId) -> Arc<RawItems>; |
48 | 49 | ||
49 | #[salsa::invoke(CrateDefMap::crate_def_map_query)] | 50 | #[salsa::transparent] |
50 | fn crate_def_map(&self, krate: CrateId) -> Arc<CrateDefMap>; | 51 | fn crate_def_map(&self, krate: CrateId) -> Arc<CrateDefMap>; |
51 | 52 | ||
53 | #[salsa::invoke(CrateDefMap::compute_crate_def_map_query)] | ||
54 | fn compute_crate_def_map(&self, krate: CrateId) -> Arc<CrateDefMap>; | ||
55 | |||
52 | #[salsa::invoke(StructData::struct_data_query)] | 56 | #[salsa::invoke(StructData::struct_data_query)] |
53 | fn struct_data(&self, id: StructId) -> Arc<StructData>; | 57 | fn struct_data(&self, id: StructId) -> Arc<StructData>; |
54 | #[salsa::invoke(StructData::union_data_query)] | 58 | #[salsa::invoke(StructData::union_data_query)] |
@@ -104,3 +108,8 @@ pub trait DefDatabase: InternDatabase + AstDatabase { | |||
104 | #[salsa::invoke(Documentation::documentation_query)] | 108 | #[salsa::invoke(Documentation::documentation_query)] |
105 | fn documentation(&self, def: AttrDefId) -> Option<Documentation>; | 109 | fn documentation(&self, def: AttrDefId) -> Option<Documentation>; |
106 | } | 110 | } |
111 | |||
112 | fn crate_def_map(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> { | ||
113 | let _p = profile("crate_def_map"); | ||
114 | db.compute_crate_def_map(krate) | ||
115 | } | ||
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs index 5d4ca73a3..4d210eab1 100644 --- a/crates/ra_hir_def/src/nameres.rs +++ b/crates/ra_hir_def/src/nameres.rs | |||
@@ -172,13 +172,13 @@ pub struct ModuleData { | |||
172 | } | 172 | } |
173 | 173 | ||
174 | impl CrateDefMap { | 174 | impl CrateDefMap { |
175 | pub(crate) fn crate_def_map_query( | 175 | pub(crate) fn compute_crate_def_map_query( |
176 | // Note that this doesn't have `+ AstDatabase`! | 176 | // Note that this doesn't have `+ AstDatabase`! |
177 | // This gurantess that `CrateDefMap` is stable across reparses. | 177 | // This gurantess that `CrateDefMap` is stable across reparses. |
178 | db: &impl DefDatabase, | 178 | db: &impl DefDatabase, |
179 | krate: CrateId, | 179 | krate: CrateId, |
180 | ) -> Arc<CrateDefMap> { | 180 | ) -> Arc<CrateDefMap> { |
181 | let _p = profile("crate_def_map_query"); | 181 | let _p = profile("compute_crate_def_map"); |
182 | let def_map = { | 182 | let def_map = { |
183 | let crate_graph = db.crate_graph(); | 183 | let crate_graph = db.crate_graph(); |
184 | let edition = crate_graph.edition(krate); | 184 | let edition = crate_graph.edition(krate); |
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 8a22b0585..35b852ee2 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -45,7 +45,6 @@ pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> C | |||
45 | // If the dependency defines a prelude, we overwrite an already defined | 45 | // If the dependency defines a prelude, we overwrite an already defined |
46 | // prelude. This is necessary to import the "std" prelude if a crate | 46 | // prelude. This is necessary to import the "std" prelude if a crate |
47 | // depends on both "core" and "std". | 47 | // depends on both "core" and "std". |
48 | let dep_def_map = db.crate_def_map(dep.crate_id); | ||
49 | if dep_def_map.prelude.is_some() { | 48 | if dep_def_map.prelude.is_some() { |
50 | def_map.prelude = dep_def_map.prelude; | 49 | def_map.prelude = dep_def_map.prelude; |
51 | } | 50 | } |
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs index d52f65b83..eb521c7a0 100644 --- a/crates/ra_hir_ty/src/db.rs +++ b/crates/ra_hir_ty/src/db.rs | |||
@@ -7,6 +7,7 @@ use hir_def::{ | |||
7 | }; | 7 | }; |
8 | use ra_arena::map::ArenaMap; | 8 | use ra_arena::map::ArenaMap; |
9 | use ra_db::{salsa, CrateId}; | 9 | use ra_db::{salsa, CrateId}; |
10 | use ra_prof::profile; | ||
10 | 11 | ||
11 | use crate::{ | 12 | use crate::{ |
12 | method_resolution::CrateImplBlocks, | 13 | method_resolution::CrateImplBlocks, |
@@ -18,9 +19,12 @@ use crate::{ | |||
18 | #[salsa::query_group(HirDatabaseStorage)] | 19 | #[salsa::query_group(HirDatabaseStorage)] |
19 | #[salsa::requires(salsa::Database)] | 20 | #[salsa::requires(salsa::Database)] |
20 | pub trait HirDatabase: DefDatabase { | 21 | pub trait HirDatabase: DefDatabase { |
21 | #[salsa::invoke(crate::infer_query)] | 22 | #[salsa::transparent] |
22 | fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>; | 23 | fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>; |
23 | 24 | ||
25 | #[salsa::invoke(crate::do_infer_query)] | ||
26 | fn do_infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>; | ||
27 | |||
24 | #[salsa::invoke(crate::lower::ty_query)] | 28 | #[salsa::invoke(crate::lower::ty_query)] |
25 | #[salsa::cycle(crate::lower::ty_recover)] | 29 | #[salsa::cycle(crate::lower::ty_recover)] |
26 | fn ty(&self, def: TyDefId) -> Ty; | 30 | fn ty(&self, def: TyDefId) -> Ty; |
@@ -104,6 +108,11 @@ pub trait HirDatabase: DefDatabase { | |||
104 | ) -> Option<crate::traits::Solution>; | 108 | ) -> Option<crate::traits::Solution>; |
105 | } | 109 | } |
106 | 110 | ||
111 | fn infer(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { | ||
112 | let _p = profile("infer"); | ||
113 | db.do_infer(def) | ||
114 | } | ||
115 | |||
107 | #[test] | 116 | #[test] |
108 | fn hir_database_is_object_safe() { | 117 | fn hir_database_is_object_safe() { |
109 | fn _assert_object_safe(_: &dyn HirDatabase) {} | 118 | fn _assert_object_safe(_: &dyn HirDatabase) {} |
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs index 37e69599d..e2eda3134 100644 --- a/crates/ra_hir_ty/src/infer.rs +++ b/crates/ra_hir_ty/src/infer.rs | |||
@@ -62,8 +62,8 @@ mod pat; | |||
62 | mod coerce; | 62 | mod coerce; |
63 | 63 | ||
64 | /// The entry point of type inference. | 64 | /// The entry point of type inference. |
65 | pub fn infer_query(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { | 65 | pub fn do_infer_query(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { |
66 | let _p = profile("infer_query"); | 66 | let _p = profile("do_infer"); |
67 | let resolver = def.resolver(db); | 67 | let resolver = def.resolver(db); |
68 | let mut ctx = InferenceContext::new(db, def, resolver); | 68 | let mut ctx = InferenceContext::new(db, def, resolver); |
69 | 69 | ||
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs index 55b6dd836..d63f862dc 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/ra_hir_ty/src/lib.rs | |||
@@ -58,7 +58,7 @@ use crate::{ | |||
58 | use display::{HirDisplay, HirFormatter}; | 58 | use display::{HirDisplay, HirFormatter}; |
59 | 59 | ||
60 | pub use autoderef::autoderef; | 60 | pub use autoderef::autoderef; |
61 | pub use infer::{infer_query, InferTy, InferenceResult}; | 61 | pub use infer::{do_infer_query, InferTy, InferenceResult}; |
62 | pub use lower::CallableDef; | 62 | pub use lower::CallableDef; |
63 | pub use lower::{callable_item_sig, TyDefId, ValueTyDefId}; | 63 | pub use lower::{callable_item_sig, TyDefId, ValueTyDefId}; |
64 | pub use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment}; | 64 | pub use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment}; |
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs index af3db2e1d..2c2ecee9c 100644 --- a/crates/ra_hir_ty/src/lower.rs +++ b/crates/ra_hir_ty/src/lower.rs | |||
@@ -331,7 +331,7 @@ pub(super) fn substs_from_path_segment( | |||
331 | if let Some(generic_args) = &segment.args_and_bindings { | 331 | if let Some(generic_args) = &segment.args_and_bindings { |
332 | // if args are provided, it should be all of them, but we can't rely on that | 332 | // if args are provided, it should be all of them, but we can't rely on that |
333 | let self_param_correction = if add_self_param { 1 } else { 0 }; | 333 | let self_param_correction = if add_self_param { 1 } else { 0 }; |
334 | let child_len = child_len + self_param_correction; | 334 | let child_len = child_len - self_param_correction; |
335 | for arg in generic_args.args.iter().take(child_len) { | 335 | for arg in generic_args.args.iter().take(child_len) { |
336 | match arg { | 336 | match arg { |
337 | GenericArg::Type(type_ref) => { | 337 | GenericArg::Type(type_ref) => { |
diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/ra_hir_ty/src/tests/regression.rs index 8b3aa8564..13c5f62e4 100644 --- a/crates/ra_hir_ty/src/tests/regression.rs +++ b/crates/ra_hir_ty/src/tests/regression.rs | |||
@@ -365,3 +365,20 @@ fn issue_2669() { | |||
365 | "### | 365 | "### |
366 | ) | 366 | ) |
367 | } | 367 | } |
368 | |||
369 | #[test] | ||
370 | fn issue_2705() { | ||
371 | assert_snapshot!( | ||
372 | infer(r#" | ||
373 | trait Trait {} | ||
374 | fn test() { | ||
375 | <Trait<u32>>::foo() | ||
376 | } | ||
377 | "#), | ||
378 | @r###" | ||
379 | [26; 53) '{ ...oo() }': () | ||
380 | [32; 49) '<Trait...>::foo': {unknown} | ||
381 | [32; 51) '<Trait...:foo()': () | ||
382 | "### | ||
383 | ); | ||
384 | } | ||
diff --git a/crates/ra_ide/src/change.rs b/crates/ra_ide/src/change.rs index 387a9cafb..f92950b71 100644 --- a/crates/ra_ide/src/change.rs +++ b/crates/ra_ide/src/change.rs | |||
@@ -273,7 +273,7 @@ impl RootDatabase { | |||
273 | self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); | 273 | self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); |
274 | 274 | ||
275 | self.query(hir::db::ExprScopesQuery).sweep(sweep); | 275 | self.query(hir::db::ExprScopesQuery).sweep(sweep); |
276 | self.query(hir::db::InferQuery).sweep(sweep); | 276 | self.query(hir::db::DoInferQuery).sweep(sweep); |
277 | self.query(hir::db::BodyQuery).sweep(sweep); | 277 | self.query(hir::db::BodyQuery).sweep(sweep); |
278 | } | 278 | } |
279 | 279 | ||
@@ -309,7 +309,7 @@ impl RootDatabase { | |||
309 | hir::db::EnumDataQuery | 309 | hir::db::EnumDataQuery |
310 | hir::db::TraitDataQuery | 310 | hir::db::TraitDataQuery |
311 | hir::db::RawItemsQuery | 311 | hir::db::RawItemsQuery |
312 | hir::db::CrateDefMapQuery | 312 | hir::db::ComputeCrateDefMapQuery |
313 | hir::db::GenericParamsQuery | 313 | hir::db::GenericParamsQuery |
314 | hir::db::FunctionDataQuery | 314 | hir::db::FunctionDataQuery |
315 | hir::db::TypeAliasDataQuery | 315 | hir::db::TypeAliasDataQuery |
@@ -320,7 +320,7 @@ impl RootDatabase { | |||
320 | hir::db::LangItemQuery | 320 | hir::db::LangItemQuery |
321 | hir::db::DocumentationQuery | 321 | hir::db::DocumentationQuery |
322 | hir::db::ExprScopesQuery | 322 | hir::db::ExprScopesQuery |
323 | hir::db::InferQuery | 323 | hir::db::DoInferQuery |
324 | hir::db::TyQuery | 324 | hir::db::TyQuery |
325 | hir::db::ValueTyQuery | 325 | hir::db::ValueTyQuery |
326 | hir::db::FieldTypesQuery | 326 | hir::db::FieldTypesQuery |