diff options
35 files changed, 242 insertions, 209 deletions
diff --git a/Cargo.lock b/Cargo.lock index 965d5aaa0..0826b056a 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -891,17 +891,14 @@ version = "0.1.0" | |||
891 | name = "ra_assists" | 891 | name = "ra_assists" |
892 | version = "0.1.0" | 892 | version = "0.1.0" |
893 | dependencies = [ | 893 | dependencies = [ |
894 | "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
895 | "format-buf 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | 894 | "format-buf 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", |
896 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | 895 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", |
897 | "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | 896 | "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", |
898 | "once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
899 | "ra_db 0.1.0", | 897 | "ra_db 0.1.0", |
900 | "ra_fmt 0.1.0", | 898 | "ra_fmt 0.1.0", |
901 | "ra_hir 0.1.0", | 899 | "ra_hir 0.1.0", |
902 | "ra_syntax 0.1.0", | 900 | "ra_syntax 0.1.0", |
903 | "ra_text_edit 0.1.0", | 901 | "ra_text_edit 0.1.0", |
904 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
905 | "rustc_lexer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | 902 | "rustc_lexer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", |
906 | "test_utils 0.1.0", | 903 | "test_utils 0.1.0", |
907 | ] | 904 | ] |
@@ -1031,8 +1028,6 @@ dependencies = [ | |||
1031 | "lsp-server 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1028 | "lsp-server 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1032 | "lsp-types 0.61.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1029 | "lsp-types 0.61.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1033 | "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1030 | "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1034 | "ra_cfg 0.1.0", | ||
1035 | "ra_db 0.1.0", | ||
1036 | "ra_ide_api 0.1.0", | 1031 | "ra_ide_api 0.1.0", |
1037 | "ra_prof 0.1.0", | 1032 | "ra_prof 0.1.0", |
1038 | "ra_project_model 0.1.0", | 1033 | "ra_project_model 0.1.0", |
@@ -1053,7 +1048,6 @@ dependencies = [ | |||
1053 | name = "ra_mbe" | 1048 | name = "ra_mbe" |
1054 | version = "0.1.0" | 1049 | version = "0.1.0" |
1055 | dependencies = [ | 1050 | dependencies = [ |
1056 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
1057 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", | 1051 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", |
1058 | "ra_parser 0.1.0", | 1052 | "ra_parser 0.1.0", |
1059 | "ra_syntax 0.1.0", | 1053 | "ra_syntax 0.1.0", |
diff --git a/crates/ra_assists/Cargo.toml b/crates/ra_assists/Cargo.toml index d3b6aeb36..beebccbd9 100644 --- a/crates/ra_assists/Cargo.toml +++ b/crates/ra_assists/Cargo.toml | |||
@@ -6,11 +6,8 @@ authors = ["rust-analyzer developers"] | |||
6 | 6 | ||
7 | [dependencies] | 7 | [dependencies] |
8 | format-buf = "1.0.0" | 8 | format-buf = "1.0.0" |
9 | once_cell = "1.0.1" | ||
10 | join_to_string = "0.1.3" | 9 | join_to_string = "0.1.3" |
11 | itertools = "0.8.0" | 10 | itertools = "0.8.0" |
12 | arrayvec = "0.4.10" | ||
13 | rustc-hash = "1.0.1" | ||
14 | rustc_lexer = "0.1.0" | 11 | rustc_lexer = "0.1.0" |
15 | 12 | ||
16 | ra_syntax = { path = "../ra_syntax" } | 13 | ra_syntax = { path = "../ra_syntax" } |
diff --git a/crates/ra_assists/src/assists/move_bounds.rs b/crates/ra_assists/src/assists/move_bounds.rs index f791d22b0..d2444b6b9 100644 --- a/crates/ra_assists/src/assists/move_bounds.rs +++ b/crates/ra_assists/src/assists/move_bounds.rs | |||
@@ -18,7 +18,7 @@ pub(crate) fn move_bounds_to_where_clause(mut ctx: AssistCtx<impl HirDatabase>) | |||
18 | } | 18 | } |
19 | 19 | ||
20 | let parent = type_param_list.syntax().parent()?; | 20 | let parent = type_param_list.syntax().parent()?; |
21 | if parent.children_with_tokens().find(|it| it.kind() == WHERE_CLAUSE).is_some() { | 21 | if parent.children_with_tokens().any(|it| it.kind() == WHERE_CLAUSE) { |
22 | return None; | 22 | return None; |
23 | } | 23 | } |
24 | 24 | ||
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs index 602beb439..df49eb13d 100644 --- a/crates/ra_batch/src/lib.rs +++ b/crates/ra_batch/src/lib.rs | |||
@@ -141,14 +141,8 @@ mod tests { | |||
141 | #[test] | 141 | #[test] |
142 | fn test_loading_rust_analyzer() { | 142 | fn test_loading_rust_analyzer() { |
143 | let path = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap().parent().unwrap(); | 143 | let path = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap().parent().unwrap(); |
144 | let (host, roots) = load_cargo(path).unwrap(); | 144 | let (host, _roots) = load_cargo(path).unwrap(); |
145 | let mut n_crates = 0; | 145 | let n_crates = Crate::all(host.raw_database()).len(); |
146 | for (root, _) in roots { | ||
147 | for _krate in Crate::source_root_crates(host.raw_database(), root) { | ||
148 | n_crates += 1; | ||
149 | } | ||
150 | } | ||
151 | |||
152 | // RA has quite a few crates, but the exact count doesn't matter | 146 | // RA has quite a few crates, but the exact count doesn't matter |
153 | assert!(n_crates > 20); | 147 | assert!(n_crates > 20); |
154 | } | 148 | } |
diff --git a/crates/ra_cli/src/analysis_bench.rs b/crates/ra_cli/src/analysis_bench.rs index 727f1e62b..8bbe5d9e8 100644 --- a/crates/ra_cli/src/analysis_bench.rs +++ b/crates/ra_cli/src/analysis_bench.rs | |||
@@ -8,7 +8,7 @@ use std::{ | |||
8 | 8 | ||
9 | use ra_db::{ | 9 | use ra_db::{ |
10 | salsa::{Database, Durability}, | 10 | salsa::{Database, Durability}, |
11 | FileId, SourceDatabase, | 11 | FileId, SourceDatabaseExt, |
12 | }; | 12 | }; |
13 | use ra_ide_api::{Analysis, AnalysisChange, AnalysisHost, FilePosition, LineCol}; | 13 | use ra_ide_api::{Analysis, AnalysisChange, AnalysisHost, FilePosition, LineCol}; |
14 | 14 | ||
diff --git a/crates/ra_cli/src/analysis_stats.rs b/crates/ra_cli/src/analysis_stats.rs index a8a110bd9..35c867dce 100644 --- a/crates/ra_cli/src/analysis_stats.rs +++ b/crates/ra_cli/src/analysis_stats.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use std::{collections::HashSet, fmt::Write, path::Path, time::Instant}; | 3 | use std::{collections::HashSet, fmt::Write, path::Path, time::Instant}; |
4 | 4 | ||
5 | use ra_db::SourceDatabase; | 5 | use ra_db::SourceDatabaseExt; |
6 | use ra_hir::{AssocItem, Crate, HasBodySource, HasSource, HirDisplay, ModuleDef, Ty, TypeWalk}; | 6 | use ra_hir::{AssocItem, Crate, HasBodySource, HasSource, HirDisplay, ModuleDef, Ty, TypeWalk}; |
7 | use ra_syntax::AstNode; | 7 | use ra_syntax::AstNode; |
8 | 8 | ||
@@ -22,16 +22,29 @@ pub fn run( | |||
22 | let mut num_crates = 0; | 22 | let mut num_crates = 0; |
23 | let mut visited_modules = HashSet::new(); | 23 | let mut visited_modules = HashSet::new(); |
24 | let mut visit_queue = Vec::new(); | 24 | let mut visit_queue = Vec::new(); |
25 | for (source_root_id, project_root) in roots { | 25 | |
26 | if project_root.is_member() { | 26 | let members = roots |
27 | for krate in Crate::source_root_crates(db, source_root_id) { | 27 | .into_iter() |
28 | num_crates += 1; | 28 | .filter_map( |
29 | let module = | 29 | |(source_root_id, project_root)| { |
30 | krate.root_module(db).expect("crate in source root without root module"); | 30 | if project_root.is_member() { |
31 | visit_queue.push(module); | 31 | Some(source_root_id) |
32 | } | 32 | } else { |
33 | None | ||
34 | } | ||
35 | }, | ||
36 | ) | ||
37 | .collect::<HashSet<_>>(); | ||
38 | |||
39 | for krate in Crate::all(db) { | ||
40 | let module = krate.root_module(db).expect("crate without root module"); | ||
41 | let file_id = module.definition_source(db).file_id; | ||
42 | if members.contains(&db.file_source_root(file_id.original_file(db))) { | ||
43 | num_crates += 1; | ||
44 | visit_queue.push(module); | ||
33 | } | 45 | } |
34 | } | 46 | } |
47 | |||
35 | println!("Crates in this dir: {}", num_crates); | 48 | println!("Crates in this dir: {}", num_crates); |
36 | let mut num_decls = 0; | 49 | let mut num_decls = 0; |
37 | let mut funcs = Vec::new(); | 50 | let mut funcs = Vec::new(); |
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index cae51b02c..eafa95921 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -57,7 +57,7 @@ impl SourceRoot { | |||
57 | pub fn walk(&self) -> impl Iterator<Item = FileId> + '_ { | 57 | pub fn walk(&self) -> impl Iterator<Item = FileId> + '_ { |
58 | self.files.values().copied() | 58 | self.files.values().copied() |
59 | } | 59 | } |
60 | pub(crate) fn file_by_relative_path(&self, path: &RelativePath) -> Option<FileId> { | 60 | pub fn file_by_relative_path(&self, path: &RelativePath) -> Option<FileId> { |
61 | self.files.get(path).copied() | 61 | self.files.get(path).copied() |
62 | } | 62 | } |
63 | } | 63 | } |
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index 4d3a9c036..fc5d6d396 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs | |||
@@ -64,21 +64,39 @@ pub struct FileRange { | |||
64 | 64 | ||
65 | pub const DEFAULT_LRU_CAP: usize = 128; | 65 | pub const DEFAULT_LRU_CAP: usize = 128; |
66 | 66 | ||
67 | /// Database which stores all significant input facts: source code and project | 67 | pub trait FileLoader { |
68 | /// model. Everything else in rust-analyzer is derived from these queries. | ||
69 | #[salsa::query_group(SourceDatabaseStorage)] | ||
70 | pub trait SourceDatabase: CheckCanceled + std::fmt::Debug { | ||
71 | /// Text of the file. | 68 | /// Text of the file. |
72 | #[salsa::input] | ||
73 | fn file_text(&self, file_id: FileId) -> Arc<String>; | 69 | fn file_text(&self, file_id: FileId) -> Arc<String>; |
74 | |||
75 | #[salsa::transparent] | ||
76 | fn resolve_relative_path(&self, anchor: FileId, relative_path: &RelativePath) | 70 | fn resolve_relative_path(&self, anchor: FileId, relative_path: &RelativePath) |
77 | -> Option<FileId>; | 71 | -> Option<FileId>; |
72 | fn relevant_crates(&self, file_id: FileId) -> Arc<Vec<CrateId>>; | ||
73 | } | ||
78 | 74 | ||
75 | /// Database which stores all significant input facts: source code and project | ||
76 | /// model. Everything else in rust-analyzer is derived from these queries. | ||
77 | #[salsa::query_group(SourceDatabaseStorage)] | ||
78 | pub trait SourceDatabase: CheckCanceled + FileLoader + std::fmt::Debug { | ||
79 | // Parses the file into the syntax tree. | 79 | // Parses the file into the syntax tree. |
80 | #[salsa::invoke(parse_query)] | 80 | #[salsa::invoke(parse_query)] |
81 | fn parse(&self, file_id: FileId) -> Parse<ast::SourceFile>; | 81 | fn parse(&self, file_id: FileId) -> Parse<ast::SourceFile>; |
82 | |||
83 | /// The crate graph. | ||
84 | #[salsa::input] | ||
85 | fn crate_graph(&self) -> Arc<CrateGraph>; | ||
86 | } | ||
87 | |||
88 | fn parse_query(db: &impl SourceDatabase, file_id: FileId) -> Parse<ast::SourceFile> { | ||
89 | let _p = profile("parse_query"); | ||
90 | let text = db.file_text(file_id); | ||
91 | SourceFile::parse(&*text) | ||
92 | } | ||
93 | |||
94 | /// We don't want to give HIR knowledge of source roots, hence we extract these | ||
95 | /// methods into a separate DB. | ||
96 | #[salsa::query_group(SourceDatabaseExtStorage)] | ||
97 | pub trait SourceDatabaseExt: SourceDatabase { | ||
98 | #[salsa::input] | ||
99 | fn file_text(&self, file_id: FileId) -> Arc<String>; | ||
82 | /// Path to a file, relative to the root of its source root. | 100 | /// Path to a file, relative to the root of its source root. |
83 | #[salsa::input] | 101 | #[salsa::input] |
84 | fn file_relative_path(&self, file_id: FileId) -> RelativePathBuf; | 102 | fn file_relative_path(&self, file_id: FileId) -> RelativePathBuf; |
@@ -88,40 +106,48 @@ pub trait SourceDatabase: CheckCanceled + std::fmt::Debug { | |||
88 | /// Contents of the source root. | 106 | /// Contents of the source root. |
89 | #[salsa::input] | 107 | #[salsa::input] |
90 | fn source_root(&self, id: SourceRootId) -> Arc<SourceRoot>; | 108 | fn source_root(&self, id: SourceRootId) -> Arc<SourceRoot>; |
91 | fn source_root_crates(&self, id: SourceRootId) -> Arc<Vec<CrateId>>; | ||
92 | /// The crate graph. | ||
93 | #[salsa::input] | ||
94 | fn crate_graph(&self) -> Arc<CrateGraph>; | ||
95 | } | ||
96 | 109 | ||
97 | fn resolve_relative_path( | 110 | fn source_root_crates(&self, id: SourceRootId) -> Arc<Vec<CrateId>>; |
98 | db: &impl SourceDatabase, | ||
99 | anchor: FileId, | ||
100 | relative_path: &RelativePath, | ||
101 | ) -> Option<FileId> { | ||
102 | let path = { | ||
103 | let mut path = db.file_relative_path(anchor); | ||
104 | // Workaround for relative path API: turn `lib.rs` into ``. | ||
105 | if !path.pop() { | ||
106 | path = RelativePathBuf::default(); | ||
107 | } | ||
108 | path.push(relative_path); | ||
109 | path.normalize() | ||
110 | }; | ||
111 | let source_root = db.file_source_root(anchor); | ||
112 | let source_root = db.source_root(source_root); | ||
113 | source_root.file_by_relative_path(&path) | ||
114 | } | 111 | } |
115 | 112 | ||
116 | fn source_root_crates(db: &impl SourceDatabase, id: SourceRootId) -> Arc<Vec<CrateId>> { | 113 | fn source_root_crates( |
114 | db: &(impl SourceDatabaseExt + SourceDatabase), | ||
115 | id: SourceRootId, | ||
116 | ) -> Arc<Vec<CrateId>> { | ||
117 | let root = db.source_root(id); | 117 | let root = db.source_root(id); |
118 | let graph = db.crate_graph(); | 118 | let graph = db.crate_graph(); |
119 | let res = root.walk().filter_map(|it| graph.crate_id_for_crate_root(it)).collect::<Vec<_>>(); | 119 | let res = root.walk().filter_map(|it| graph.crate_id_for_crate_root(it)).collect::<Vec<_>>(); |
120 | Arc::new(res) | 120 | Arc::new(res) |
121 | } | 121 | } |
122 | 122 | ||
123 | fn parse_query(db: &impl SourceDatabase, file_id: FileId) -> Parse<ast::SourceFile> { | 123 | /// Silly workaround for cyclic deps between the traits |
124 | let _p = profile("parse_query"); | 124 | pub struct FileLoaderDelegate<T>(pub T); |
125 | let text = db.file_text(file_id); | 125 | |
126 | SourceFile::parse(&*text) | 126 | impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> { |
127 | fn file_text(&self, file_id: FileId) -> Arc<String> { | ||
128 | SourceDatabaseExt::file_text(self.0, file_id) | ||
129 | } | ||
130 | fn resolve_relative_path( | ||
131 | &self, | ||
132 | anchor: FileId, | ||
133 | relative_path: &RelativePath, | ||
134 | ) -> Option<FileId> { | ||
135 | let path = { | ||
136 | let mut path = self.0.file_relative_path(anchor); | ||
137 | // Workaround for relative path API: turn `lib.rs` into ``. | ||
138 | if !path.pop() { | ||
139 | path = RelativePathBuf::default(); | ||
140 | } | ||
141 | path.push(relative_path); | ||
142 | path.normalize() | ||
143 | }; | ||
144 | let source_root = self.0.file_source_root(anchor); | ||
145 | let source_root = self.0.source_root(source_root); | ||
146 | source_root.file_by_relative_path(&path) | ||
147 | } | ||
148 | |||
149 | fn relevant_crates(&self, file_id: FileId) -> Arc<Vec<CrateId>> { | ||
150 | let source_root = self.0.file_source_root(file_id); | ||
151 | self.0.source_root_crates(source_root) | ||
152 | } | ||
127 | } | 153 | } |
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 8055a07db..8eb3c577d 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -5,7 +5,7 @@ pub(crate) mod docs; | |||
5 | 5 | ||
6 | use std::sync::Arc; | 6 | use std::sync::Arc; |
7 | 7 | ||
8 | use ra_db::{CrateId, Edition, FileId, SourceRootId}; | 8 | use ra_db::{CrateId, Edition, FileId}; |
9 | use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; | 9 | use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; |
10 | 10 | ||
11 | use crate::{ | 11 | use crate::{ |
@@ -76,10 +76,8 @@ impl Crate { | |||
76 | crate_graph.edition(self.crate_id) | 76 | crate_graph.edition(self.crate_id) |
77 | } | 77 | } |
78 | 78 | ||
79 | // FIXME: should this be in source_binder? | 79 | pub fn all(db: &impl DefDatabase) -> Vec<Crate> { |
80 | pub fn source_root_crates(db: &impl DefDatabase, source_root: SourceRootId) -> Vec<Crate> { | 80 | db.crate_graph().iter().map(|crate_id| Crate { crate_id }).collect() |
81 | let crate_ids = db.source_root_crates(source_root); | ||
82 | crate_ids.iter().map(|&crate_id| Crate { crate_id }).collect() | ||
83 | } | 81 | } |
84 | } | 82 | } |
85 | 83 | ||
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index 73d7d6fb6..489a3b19c 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -111,37 +111,37 @@ pub trait DefDatabase: InternDatabase + HirDebugDatabase { | |||
111 | #[salsa::invoke(CrateDefMap::crate_def_map_query)] | 111 | #[salsa::invoke(CrateDefMap::crate_def_map_query)] |
112 | fn crate_def_map(&self, krate: Crate) -> Arc<CrateDefMap>; | 112 | fn crate_def_map(&self, krate: Crate) -> Arc<CrateDefMap>; |
113 | 113 | ||
114 | #[salsa::invoke(crate::impl_block::impls_in_module_with_source_map_query)] | 114 | #[salsa::invoke(ModuleImplBlocks::impls_in_module_with_source_map_query)] |
115 | fn impls_in_module_with_source_map( | 115 | fn impls_in_module_with_source_map( |
116 | &self, | 116 | &self, |
117 | module: Module, | 117 | module: Module, |
118 | ) -> (Arc<ModuleImplBlocks>, Arc<ImplSourceMap>); | 118 | ) -> (Arc<ModuleImplBlocks>, Arc<ImplSourceMap>); |
119 | 119 | ||
120 | #[salsa::invoke(crate::impl_block::impls_in_module)] | 120 | #[salsa::invoke(ModuleImplBlocks::impls_in_module_query)] |
121 | fn impls_in_module(&self, module: Module) -> Arc<ModuleImplBlocks>; | 121 | fn impls_in_module(&self, module: Module) -> Arc<ModuleImplBlocks>; |
122 | 122 | ||
123 | #[salsa::invoke(crate::generics::GenericParams::generic_params_query)] | 123 | #[salsa::invoke(crate::generics::GenericParams::generic_params_query)] |
124 | fn generic_params(&self, def: GenericDef) -> Arc<GenericParams>; | 124 | fn generic_params(&self, def: GenericDef) -> Arc<GenericParams>; |
125 | 125 | ||
126 | #[salsa::invoke(crate::FnData::fn_data_query)] | 126 | #[salsa::invoke(FnData::fn_data_query)] |
127 | fn fn_data(&self, func: Function) -> Arc<FnData>; | 127 | fn fn_data(&self, func: Function) -> Arc<FnData>; |
128 | 128 | ||
129 | #[salsa::invoke(crate::type_alias::type_alias_data_query)] | 129 | #[salsa::invoke(TypeAliasData::type_alias_data_query)] |
130 | fn type_alias_data(&self, typ: TypeAlias) -> Arc<TypeAliasData>; | 130 | fn type_alias_data(&self, typ: TypeAlias) -> Arc<TypeAliasData>; |
131 | 131 | ||
132 | #[salsa::invoke(crate::ConstData::const_data_query)] | 132 | #[salsa::invoke(ConstData::const_data_query)] |
133 | fn const_data(&self, konst: Const) -> Arc<ConstData>; | 133 | fn const_data(&self, konst: Const) -> Arc<ConstData>; |
134 | 134 | ||
135 | #[salsa::invoke(crate::ConstData::static_data_query)] | 135 | #[salsa::invoke(ConstData::static_data_query)] |
136 | fn static_data(&self, konst: Static) -> Arc<ConstData>; | 136 | fn static_data(&self, konst: Static) -> Arc<ConstData>; |
137 | 137 | ||
138 | #[salsa::invoke(crate::lang_item::LangItems::module_lang_items_query)] | 138 | #[salsa::invoke(LangItems::module_lang_items_query)] |
139 | fn module_lang_items(&self, module: Module) -> Option<Arc<LangItems>>; | 139 | fn module_lang_items(&self, module: Module) -> Option<Arc<LangItems>>; |
140 | 140 | ||
141 | #[salsa::invoke(crate::lang_item::LangItems::crate_lang_items_query)] | 141 | #[salsa::invoke(LangItems::crate_lang_items_query)] |
142 | fn crate_lang_items(&self, krate: Crate) -> Arc<LangItems>; | 142 | fn crate_lang_items(&self, krate: Crate) -> Arc<LangItems>; |
143 | 143 | ||
144 | #[salsa::invoke(crate::lang_item::LangItems::lang_item_query)] | 144 | #[salsa::invoke(LangItems::lang_item_query)] |
145 | fn lang_item(&self, start_crate: Crate, item: SmolStr) -> Option<LangItemTarget>; | 145 | fn lang_item(&self, start_crate: Crate, item: SmolStr) -> Option<LangItemTarget>; |
146 | 146 | ||
147 | #[salsa::invoke(crate::code_model::docs::documentation_query)] | 147 | #[salsa::invoke(crate::code_model::docs::documentation_query)] |
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs index a012f33f7..f80d8eb5f 100644 --- a/crates/ra_hir/src/from_source.rs +++ b/crates/ra_hir/src/from_source.rs | |||
@@ -189,14 +189,14 @@ impl Module { | |||
189 | ModuleSource::SourceFile(_) => None, | 189 | ModuleSource::SourceFile(_) => None, |
190 | }; | 190 | }; |
191 | 191 | ||
192 | let source_root_id = db.file_source_root(src.file_id.original_file(db)); | 192 | db.relevant_crates(src.file_id.original_file(db)) |
193 | db.source_root_crates(source_root_id).iter().map(|&crate_id| Crate { crate_id }).find_map( | 193 | .iter() |
194 | |krate| { | 194 | .map(|&crate_id| Crate { crate_id }) |
195 | .find_map(|krate| { | ||
195 | let def_map = db.crate_def_map(krate); | 196 | let def_map = db.crate_def_map(krate); |
196 | let module_id = def_map.find_module_by_source(src.file_id, decl_id)?; | 197 | let module_id = def_map.find_module_by_source(src.file_id, decl_id)?; |
197 | Some(Module { krate, module_id }) | 198 | Some(Module { krate, module_id }) |
198 | }, | 199 | }) |
199 | ) | ||
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 85b022744..499dcafea 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs | |||
@@ -85,11 +85,7 @@ impl HirFileId { | |||
85 | // Note: | 85 | // Note: |
86 | // The final goal we would like to make all parse_macro success, | 86 | // The final goal we would like to make all parse_macro success, |
87 | // such that the following log will not call anyway. | 87 | // such that the following log will not call anyway. |
88 | log::warn!( | 88 | log::warn!("fail on macro_parse: (reason: {})", err,); |
89 | "fail on macro_parse: (reason: {}) {}", | ||
90 | err, | ||
91 | macro_call_id.debug_dump(db) | ||
92 | ); | ||
93 | }) | 89 | }) |
94 | .ok()?; | 90 | .ok()?; |
95 | match macro_file.macro_file_kind { | 91 | match macro_file.macro_file_kind { |
@@ -367,35 +363,6 @@ impl AstItemDef<ast::TypeAliasDef> for TypeAliasId { | |||
367 | } | 363 | } |
368 | } | 364 | } |
369 | 365 | ||
370 | impl MacroCallId { | ||
371 | pub fn debug_dump(self, db: &impl AstDatabase) -> String { | ||
372 | let loc = self.loc(db); | ||
373 | let node = loc.ast_id.to_node(db); | ||
374 | let syntax_str = { | ||
375 | let mut res = String::new(); | ||
376 | node.syntax().text().for_each_chunk(|chunk| { | ||
377 | if !res.is_empty() { | ||
378 | res.push(' ') | ||
379 | } | ||
380 | res.push_str(chunk) | ||
381 | }); | ||
382 | res | ||
383 | }; | ||
384 | |||
385 | // dump the file name | ||
386 | let file_id: HirFileId = self.loc(db).ast_id.file_id(); | ||
387 | let original = file_id.original_file(db); | ||
388 | let macro_rules = db.macro_def(loc.def); | ||
389 | |||
390 | format!( | ||
391 | "macro call [file: {:?}] : {}\nhas rules: {}", | ||
392 | db.file_relative_path(original), | ||
393 | syntax_str, | ||
394 | macro_rules.is_some() | ||
395 | ) | ||
396 | } | ||
397 | } | ||
398 | |||
399 | /// This exists just for Chalk, because Chalk just has a single `StructId` where | 366 | /// This exists just for Chalk, because Chalk just has a single `StructId` where |
400 | /// we have different kinds of ADTs, primitive types and special type | 367 | /// we have different kinds of ADTs, primitive types and special type |
401 | /// constructors like tuples and function pointers. | 368 | /// constructors like tuples and function pointers. |
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs index 55dfc393b..33ef87563 100644 --- a/crates/ra_hir/src/impl_block.rs +++ b/crates/ra_hir/src/impl_block.rs | |||
@@ -176,6 +176,25 @@ pub struct ModuleImplBlocks { | |||
176 | } | 176 | } |
177 | 177 | ||
178 | impl ModuleImplBlocks { | 178 | impl ModuleImplBlocks { |
179 | pub(crate) fn impls_in_module_with_source_map_query( | ||
180 | db: &(impl DefDatabase + AstDatabase), | ||
181 | module: Module, | ||
182 | ) -> (Arc<ModuleImplBlocks>, Arc<ImplSourceMap>) { | ||
183 | let mut source_map = ImplSourceMap::default(); | ||
184 | let crate_graph = db.crate_graph(); | ||
185 | let cfg_options = crate_graph.cfg_options(module.krate.crate_id()); | ||
186 | |||
187 | let result = ModuleImplBlocks::collect(db, cfg_options, module, &mut source_map); | ||
188 | (Arc::new(result), Arc::new(source_map)) | ||
189 | } | ||
190 | |||
191 | pub(crate) fn impls_in_module_query( | ||
192 | db: &impl DefDatabase, | ||
193 | module: Module, | ||
194 | ) -> Arc<ModuleImplBlocks> { | ||
195 | db.impls_in_module_with_source_map(module).0 | ||
196 | } | ||
197 | |||
179 | fn collect( | 198 | fn collect( |
180 | db: &(impl DefDatabase + AstDatabase), | 199 | db: &(impl DefDatabase + AstDatabase), |
181 | cfg_options: &CfgOptions, | 200 | cfg_options: &CfgOptions, |
@@ -264,19 +283,3 @@ impl ModuleImplBlocks { | |||
264 | } | 283 | } |
265 | } | 284 | } |
266 | } | 285 | } |
267 | |||
268 | pub(crate) fn impls_in_module_with_source_map_query( | ||
269 | db: &(impl DefDatabase + AstDatabase), | ||
270 | module: Module, | ||
271 | ) -> (Arc<ModuleImplBlocks>, Arc<ImplSourceMap>) { | ||
272 | let mut source_map = ImplSourceMap::default(); | ||
273 | let crate_graph = db.crate_graph(); | ||
274 | let cfg_options = crate_graph.cfg_options(module.krate.crate_id()); | ||
275 | |||
276 | let result = ModuleImplBlocks::collect(db, cfg_options, module, &mut source_map); | ||
277 | (Arc::new(result), Arc::new(source_map)) | ||
278 | } | ||
279 | |||
280 | pub(crate) fn impls_in_module(db: &impl DefDatabase, module: Module) -> Arc<ModuleImplBlocks> { | ||
281 | db.impls_in_module_with_source_map(module).0 | ||
282 | } | ||
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 9cbd9a8ae..ca261e8f5 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -51,6 +51,7 @@ mod lang_item; | |||
51 | mod generics; | 51 | mod generics; |
52 | mod resolve; | 52 | mod resolve; |
53 | pub mod diagnostics; | 53 | pub mod diagnostics; |
54 | mod util; | ||
54 | 55 | ||
55 | mod code_model; | 56 | mod code_model; |
56 | 57 | ||
diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs index 827424983..0b278deb3 100644 --- a/crates/ra_hir/src/mock.rs +++ b/crates/ra_hir/src/mock.rs | |||
@@ -5,10 +5,10 @@ use std::{panic, sync::Arc}; | |||
5 | use parking_lot::Mutex; | 5 | use parking_lot::Mutex; |
6 | use ra_cfg::CfgOptions; | 6 | use ra_cfg::CfgOptions; |
7 | use ra_db::{ | 7 | use ra_db::{ |
8 | salsa, CrateGraph, CrateId, Edition, FileId, FilePosition, SourceDatabase, SourceRoot, | 8 | salsa, CrateGraph, CrateId, Edition, FileId, FileLoader, FileLoaderDelegate, FilePosition, |
9 | SourceRootId, | 9 | SourceDatabase, SourceDatabaseExt, SourceRoot, SourceRootId, |
10 | }; | 10 | }; |
11 | use relative_path::RelativePathBuf; | 11 | use relative_path::{RelativePath, RelativePathBuf}; |
12 | use rustc_hash::FxHashMap; | 12 | use rustc_hash::FxHashMap; |
13 | use test_utils::{extract_offset, parse_fixture, CURSOR_MARKER}; | 13 | use test_utils::{extract_offset, parse_fixture, CURSOR_MARKER}; |
14 | 14 | ||
@@ -17,6 +17,7 @@ use crate::{db, debug::HirDebugHelper, diagnostics::DiagnosticSink}; | |||
17 | pub const WORKSPACE: SourceRootId = SourceRootId(0); | 17 | pub const WORKSPACE: SourceRootId = SourceRootId(0); |
18 | 18 | ||
19 | #[salsa::database( | 19 | #[salsa::database( |
20 | ra_db::SourceDatabaseExtStorage, | ||
20 | ra_db::SourceDatabaseStorage, | 21 | ra_db::SourceDatabaseStorage, |
21 | db::InternDatabaseStorage, | 22 | db::InternDatabaseStorage, |
22 | db::AstDatabaseStorage, | 23 | db::AstDatabaseStorage, |
@@ -34,6 +35,22 @@ pub struct MockDatabase { | |||
34 | 35 | ||
35 | impl panic::RefUnwindSafe for MockDatabase {} | 36 | impl panic::RefUnwindSafe for MockDatabase {} |
36 | 37 | ||
38 | impl FileLoader for MockDatabase { | ||
39 | fn file_text(&self, file_id: FileId) -> Arc<String> { | ||
40 | FileLoaderDelegate(self).file_text(file_id) | ||
41 | } | ||
42 | fn resolve_relative_path( | ||
43 | &self, | ||
44 | anchor: FileId, | ||
45 | relative_path: &RelativePath, | ||
46 | ) -> Option<FileId> { | ||
47 | FileLoaderDelegate(self).resolve_relative_path(anchor, relative_path) | ||
48 | } | ||
49 | fn relevant_crates(&self, file_id: FileId) -> Arc<Vec<CrateId>> { | ||
50 | FileLoaderDelegate(self).relevant_crates(file_id) | ||
51 | } | ||
52 | } | ||
53 | |||
37 | impl HirDebugHelper for MockDatabase { | 54 | impl HirDebugHelper for MockDatabase { |
38 | fn crate_name(&self, krate: CrateId) -> Option<String> { | 55 | fn crate_name(&self, krate: CrateId) -> Option<String> { |
39 | self.crate_names.get(&krate).cloned() | 56 | self.crate_names.get(&krate).cloned() |
diff --git a/crates/ra_hir/src/nameres/tests/incremental.rs b/crates/ra_hir/src/nameres/tests/incremental.rs index c41862a0b..af9c39760 100644 --- a/crates/ra_hir/src/nameres/tests/incremental.rs +++ b/crates/ra_hir/src/nameres/tests/incremental.rs | |||
@@ -2,7 +2,7 @@ use super::*; | |||
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use ra_db::SourceDatabase; | 5 | use ra_db::{SourceDatabase, SourceDatabaseExt}; |
6 | 6 | ||
7 | fn check_def_map_is_not_recomputed(initial: &str, file_change: &str) { | 7 | fn check_def_map_is_not_recomputed(initial: &str, file_change: &str) { |
8 | let (mut db, pos) = MockDatabase::with_position(initial); | 8 | let (mut db, pos) = MockDatabase::with_position(initial); |
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index d161735e8..cc9746f6d 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -17,8 +17,8 @@ use std::sync::Arc; | |||
17 | use std::{fmt, iter, mem}; | 17 | use std::{fmt, iter, mem}; |
18 | 18 | ||
19 | use crate::{ | 19 | use crate::{ |
20 | db::HirDatabase, expr::ExprId, type_ref::Mutability, Adt, Crate, DefWithBody, GenericParams, | 20 | db::HirDatabase, expr::ExprId, type_ref::Mutability, util::make_mut_slice, Adt, Crate, |
21 | HasGenericParams, Name, Trait, TypeAlias, | 21 | DefWithBody, GenericParams, HasGenericParams, Name, Trait, TypeAlias, |
22 | }; | 22 | }; |
23 | use display::{HirDisplay, HirFormatter}; | 23 | use display::{HirDisplay, HirFormatter}; |
24 | 24 | ||
@@ -308,12 +308,9 @@ impl Substs { | |||
308 | } | 308 | } |
309 | 309 | ||
310 | pub fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) { | 310 | pub fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) { |
311 | // Without an Arc::make_mut_slice, we can't avoid the clone here: | 311 | for t in make_mut_slice(&mut self.0) { |
312 | let mut v: Vec<_> = self.0.iter().cloned().collect(); | ||
313 | for t in &mut v { | ||
314 | t.walk_mut(f); | 312 | t.walk_mut(f); |
315 | } | 313 | } |
316 | self.0 = v.into(); | ||
317 | } | 314 | } |
318 | 315 | ||
319 | pub fn as_single(&self) -> &Ty { | 316 | pub fn as_single(&self) -> &Ty { |
@@ -330,8 +327,7 @@ impl Substs { | |||
330 | .params_including_parent() | 327 | .params_including_parent() |
331 | .into_iter() | 328 | .into_iter() |
332 | .map(|p| Ty::Param { idx: p.idx, name: p.name.clone() }) | 329 | .map(|p| Ty::Param { idx: p.idx, name: p.name.clone() }) |
333 | .collect::<Vec<_>>() | 330 | .collect(), |
334 | .into(), | ||
335 | ) | 331 | ) |
336 | } | 332 | } |
337 | 333 | ||
@@ -342,8 +338,7 @@ impl Substs { | |||
342 | .params_including_parent() | 338 | .params_including_parent() |
343 | .into_iter() | 339 | .into_iter() |
344 | .map(|p| Ty::Bound(p.idx)) | 340 | .map(|p| Ty::Bound(p.idx)) |
345 | .collect::<Vec<_>>() | 341 | .collect(), |
346 | .into(), | ||
347 | ) | 342 | ) |
348 | } | 343 | } |
349 | 344 | ||
@@ -541,12 +536,9 @@ impl TypeWalk for FnSig { | |||
541 | } | 536 | } |
542 | 537 | ||
543 | fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) { | 538 | fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) { |
544 | // Without an Arc::make_mut_slice, we can't avoid the clone here: | 539 | for t in make_mut_slice(&mut self.params_and_return) { |
545 | let mut v: Vec<_> = self.params_and_return.iter().cloned().collect(); | ||
546 | for t in &mut v { | ||
547 | t.walk_mut(f); | 540 | t.walk_mut(f); |
548 | } | 541 | } |
549 | self.params_and_return = v.into(); | ||
550 | } | 542 | } |
551 | } | 543 | } |
552 | 544 | ||
@@ -756,11 +748,9 @@ impl TypeWalk for Ty { | |||
756 | p_ty.parameters.walk_mut(f); | 748 | p_ty.parameters.walk_mut(f); |
757 | } | 749 | } |
758 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { | 750 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { |
759 | let mut v: Vec<_> = predicates.iter().cloned().collect(); | 751 | for p in make_mut_slice(predicates) { |
760 | for p in &mut v { | ||
761 | p.walk_mut(f); | 752 | p.walk_mut(f); |
762 | } | 753 | } |
763 | *predicates = v.into(); | ||
764 | } | 754 | } |
765 | Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {} | 755 | Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {} |
766 | } | 756 | } |
diff --git a/crates/ra_hir/src/ty/infer/unify.rs b/crates/ra_hir/src/ty/infer/unify.rs index d161aa6b3..014c7981f 100644 --- a/crates/ra_hir/src/ty/infer/unify.rs +++ b/crates/ra_hir/src/ty/infer/unify.rs | |||
@@ -6,6 +6,7 @@ use crate::ty::{ | |||
6 | Canonical, InEnvironment, InferTy, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, | 6 | Canonical, InEnvironment, InferTy, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, |
7 | TypeWalk, | 7 | TypeWalk, |
8 | }; | 8 | }; |
9 | use crate::util::make_mut_slice; | ||
9 | 10 | ||
10 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { | 11 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { |
11 | pub(super) fn canonicalizer<'b>(&'b mut self) -> Canonicalizer<'a, 'b, D> | 12 | pub(super) fn canonicalizer<'b>(&'b mut self) -> Canonicalizer<'a, 'b, D> |
@@ -74,10 +75,11 @@ where | |||
74 | }) | 75 | }) |
75 | } | 76 | } |
76 | 77 | ||
77 | fn do_canonicalize_trait_ref(&mut self, trait_ref: TraitRef) -> TraitRef { | 78 | fn do_canonicalize_trait_ref(&mut self, mut trait_ref: TraitRef) -> TraitRef { |
78 | let substs = | 79 | for ty in make_mut_slice(&mut trait_ref.substs.0) { |
79 | trait_ref.substs.iter().map(|ty| self.do_canonicalize_ty(ty.clone())).collect(); | 80 | *ty = self.do_canonicalize_ty(ty.clone()); |
80 | TraitRef { trait_: trait_ref.trait_, substs: Substs(substs) } | 81 | } |
82 | trait_ref | ||
81 | } | 83 | } |
82 | 84 | ||
83 | fn into_canonicalized<T>(self, result: T) -> Canonicalized<T> { | 85 | fn into_canonicalized<T>(self, result: T) -> Canonicalized<T> { |
@@ -87,10 +89,11 @@ where | |||
87 | } | 89 | } |
88 | } | 90 | } |
89 | 91 | ||
90 | fn do_canonicalize_projection_ty(&mut self, projection_ty: ProjectionTy) -> ProjectionTy { | 92 | fn do_canonicalize_projection_ty(&mut self, mut projection_ty: ProjectionTy) -> ProjectionTy { |
91 | let params = | 93 | for ty in make_mut_slice(&mut projection_ty.parameters.0) { |
92 | projection_ty.parameters.iter().map(|ty| self.do_canonicalize_ty(ty.clone())).collect(); | 94 | *ty = self.do_canonicalize_ty(ty.clone()); |
93 | ProjectionTy { associated_ty: projection_ty.associated_ty, parameters: Substs(params) } | 95 | } |
96 | projection_ty | ||
94 | } | 97 | } |
95 | 98 | ||
96 | fn do_canonicalize_projection_predicate( | 99 | fn do_canonicalize_projection_predicate( |
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index a604c02e2..366556134 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -22,6 +22,7 @@ use crate::{ | |||
22 | resolve::{Resolver, TypeNs}, | 22 | resolve::{Resolver, TypeNs}, |
23 | ty::Adt, | 23 | ty::Adt, |
24 | type_ref::{TypeBound, TypeRef}, | 24 | type_ref::{TypeBound, TypeRef}, |
25 | util::make_mut_slice, | ||
25 | BuiltinType, Const, Enum, EnumVariant, Function, ModuleDef, Path, Static, Struct, StructField, | 26 | BuiltinType, Const, Enum, EnumVariant, Function, ModuleDef, Path, Static, Struct, StructField, |
26 | Trait, TypeAlias, Union, | 27 | Trait, TypeAlias, Union, |
27 | }; | 28 | }; |
@@ -31,11 +32,11 @@ impl Ty { | |||
31 | match type_ref { | 32 | match type_ref { |
32 | TypeRef::Never => Ty::simple(TypeCtor::Never), | 33 | TypeRef::Never => Ty::simple(TypeCtor::Never), |
33 | TypeRef::Tuple(inner) => { | 34 | TypeRef::Tuple(inner) => { |
34 | let inner_tys = | 35 | let inner_tys: Arc<[Ty]> = |
35 | inner.iter().map(|tr| Ty::from_hir(db, resolver, tr)).collect::<Vec<_>>(); | 36 | inner.iter().map(|tr| Ty::from_hir(db, resolver, tr)).collect(); |
36 | Ty::apply( | 37 | Ty::apply( |
37 | TypeCtor::Tuple { cardinality: inner_tys.len() as u16 }, | 38 | TypeCtor::Tuple { cardinality: inner_tys.len() as u16 }, |
38 | Substs(inner_tys.into()), | 39 | Substs(inner_tys), |
39 | ) | 40 | ) |
40 | } | 41 | } |
41 | TypeRef::Path(path) => Ty::from_hir_path(db, resolver, path), | 42 | TypeRef::Path(path) => Ty::from_hir_path(db, resolver, path), |
@@ -57,9 +58,7 @@ impl Ty { | |||
57 | } | 58 | } |
58 | TypeRef::Placeholder => Ty::Unknown, | 59 | TypeRef::Placeholder => Ty::Unknown, |
59 | TypeRef::Fn(params) => { | 60 | TypeRef::Fn(params) => { |
60 | let inner_tys = | 61 | let sig = Substs(params.iter().map(|tr| Ty::from_hir(db, resolver, tr)).collect()); |
61 | params.iter().map(|tr| Ty::from_hir(db, resolver, tr)).collect::<Vec<_>>(); | ||
62 | let sig = Substs(inner_tys.into()); | ||
63 | Ty::apply(TypeCtor::FnPtr { num_args: sig.len() as u16 - 1 }, sig) | 62 | Ty::apply(TypeCtor::FnPtr { num_args: sig.len() as u16 - 1 }, sig) |
64 | } | 63 | } |
65 | TypeRef::DynTrait(bounds) => { | 64 | TypeRef::DynTrait(bounds) => { |
@@ -69,8 +68,8 @@ impl Ty { | |||
69 | .flat_map(|b| { | 68 | .flat_map(|b| { |
70 | GenericPredicate::from_type_bound(db, resolver, b, self_ty.clone()) | 69 | GenericPredicate::from_type_bound(db, resolver, b, self_ty.clone()) |
71 | }) | 70 | }) |
72 | .collect::<Vec<_>>(); | 71 | .collect(); |
73 | Ty::Dyn(predicates.into()) | 72 | Ty::Dyn(predicates) |
74 | } | 73 | } |
75 | TypeRef::ImplTrait(bounds) => { | 74 | TypeRef::ImplTrait(bounds) => { |
76 | let self_ty = Ty::Bound(0); | 75 | let self_ty = Ty::Bound(0); |
@@ -79,8 +78,8 @@ impl Ty { | |||
79 | .flat_map(|b| { | 78 | .flat_map(|b| { |
80 | GenericPredicate::from_type_bound(db, resolver, b, self_ty.clone()) | 79 | GenericPredicate::from_type_bound(db, resolver, b, self_ty.clone()) |
81 | }) | 80 | }) |
82 | .collect::<Vec<_>>(); | 81 | .collect(); |
83 | Ty::Opaque(predicates.into()) | 82 | Ty::Opaque(predicates) |
84 | } | 83 | } |
85 | TypeRef::Error => Ty::Unknown, | 84 | TypeRef::Error => Ty::Unknown, |
86 | } | 85 | } |
@@ -392,10 +391,7 @@ impl TraitRef { | |||
392 | ) -> Self { | 391 | ) -> Self { |
393 | let mut substs = TraitRef::substs_from_path(db, resolver, segment, resolved); | 392 | let mut substs = TraitRef::substs_from_path(db, resolver, segment, resolved); |
394 | if let Some(self_ty) = explicit_self_ty { | 393 | if let Some(self_ty) = explicit_self_ty { |
395 | // FIXME this could be nicer | 394 | make_mut_slice(&mut substs.0)[0] = self_ty; |
396 | let mut substs_vec = substs.0.to_vec(); | ||
397 | substs_vec[0] = self_ty; | ||
398 | substs.0 = substs_vec.into(); | ||
399 | } | 395 | } |
400 | TraitRef { trait_: resolved, substs } | 396 | TraitRef { trait_: resolved, substs } |
401 | } | 397 | } |
@@ -558,13 +554,12 @@ pub(crate) fn generic_predicates_for_param_query( | |||
558 | param_idx: u32, | 554 | param_idx: u32, |
559 | ) -> Arc<[GenericPredicate]> { | 555 | ) -> Arc<[GenericPredicate]> { |
560 | let resolver = def.resolver(db); | 556 | let resolver = def.resolver(db); |
561 | let predicates = resolver | 557 | resolver |
562 | .where_predicates_in_scope() | 558 | .where_predicates_in_scope() |
563 | // we have to filter out all other predicates *first*, before attempting to lower them | 559 | // we have to filter out all other predicates *first*, before attempting to lower them |
564 | .filter(|pred| Ty::from_hir_only_param(db, &resolver, &pred.type_ref) == Some(param_idx)) | 560 | .filter(|pred| Ty::from_hir_only_param(db, &resolver, &pred.type_ref) == Some(param_idx)) |
565 | .flat_map(|pred| GenericPredicate::from_where_predicate(db, &resolver, pred)) | 561 | .flat_map(|pred| GenericPredicate::from_where_predicate(db, &resolver, pred)) |
566 | .collect::<Vec<_>>(); | 562 | .collect() |
567 | predicates.into() | ||
568 | } | 563 | } |
569 | 564 | ||
570 | pub(crate) fn trait_env( | 565 | pub(crate) fn trait_env( |
@@ -585,11 +580,10 @@ pub(crate) fn generic_predicates_query( | |||
585 | def: GenericDef, | 580 | def: GenericDef, |
586 | ) -> Arc<[GenericPredicate]> { | 581 | ) -> Arc<[GenericPredicate]> { |
587 | let resolver = def.resolver(db); | 582 | let resolver = def.resolver(db); |
588 | let predicates = resolver | 583 | resolver |
589 | .where_predicates_in_scope() | 584 | .where_predicates_in_scope() |
590 | .flat_map(|pred| GenericPredicate::from_where_predicate(db, &resolver, pred)) | 585 | .flat_map(|pred| GenericPredicate::from_where_predicate(db, &resolver, pred)) |
591 | .collect::<Vec<_>>(); | 586 | .collect() |
592 | predicates.into() | ||
593 | } | 587 | } |
594 | 588 | ||
595 | /// Resolve the default type params from generics | 589 | /// Resolve the default type params from generics |
@@ -603,9 +597,9 @@ pub(crate) fn generic_defaults_query(db: &impl HirDatabase, def: GenericDef) -> | |||
603 | .map(|p| { | 597 | .map(|p| { |
604 | p.default.as_ref().map_or(Ty::Unknown, |path| Ty::from_hir_path(db, &resolver, path)) | 598 | p.default.as_ref().map_or(Ty::Unknown, |path| Ty::from_hir_path(db, &resolver, path)) |
605 | }) | 599 | }) |
606 | .collect::<Vec<_>>(); | 600 | .collect(); |
607 | 601 | ||
608 | Substs(defaults.into()) | 602 | Substs(defaults) |
609 | } | 603 | } |
610 | 604 | ||
611 | fn fn_sig_for_fn(db: &impl HirDatabase, def: Function) -> FnSig { | 605 | fn fn_sig_for_fn(db: &impl HirDatabase, def: Function) -> FnSig { |
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs index b0f67ae50..0cb5c3798 100644 --- a/crates/ra_hir/src/ty/traits.rs +++ b/crates/ra_hir/src/ty/traits.rs | |||
@@ -89,7 +89,7 @@ pub(crate) fn impls_for_trait_query( | |||
89 | } | 89 | } |
90 | let crate_impl_blocks = db.impls_in_crate(krate); | 90 | let crate_impl_blocks = db.impls_in_crate(krate); |
91 | impls.extend(crate_impl_blocks.lookup_impl_blocks_for_trait(trait_)); | 91 | impls.extend(crate_impl_blocks.lookup_impl_blocks_for_trait(trait_)); |
92 | impls.into_iter().collect::<Vec<_>>().into() | 92 | impls.into_iter().collect() |
93 | } | 93 | } |
94 | 94 | ||
95 | /// A set of clauses that we assume to be true. E.g. if we are inside this function: | 95 | /// A set of clauses that we assume to be true. E.g. if we are inside this function: |
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index 9168de709..00aaf65d9 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -126,8 +126,7 @@ impl ToChalk for Substs { | |||
126 | chalk_ir::Parameter(chalk_ir::ParameterKind::Ty(ty)) => from_chalk(db, ty), | 126 | chalk_ir::Parameter(chalk_ir::ParameterKind::Ty(ty)) => from_chalk(db, ty), |
127 | chalk_ir::Parameter(chalk_ir::ParameterKind::Lifetime(_)) => unimplemented!(), | 127 | chalk_ir::Parameter(chalk_ir::ParameterKind::Lifetime(_)) => unimplemented!(), |
128 | }) | 128 | }) |
129 | .collect::<Vec<_>>() | 129 | .collect(); |
130 | .into(); | ||
131 | Substs(tys) | 130 | Substs(tys) |
132 | } | 131 | } |
133 | } | 132 | } |
diff --git a/crates/ra_hir/src/type_alias.rs b/crates/ra_hir/src/type_alias.rs index 3b38c4740..674a46102 100644 --- a/crates/ra_hir/src/type_alias.rs +++ b/crates/ra_hir/src/type_alias.rs | |||
@@ -17,12 +17,14 @@ pub struct TypeAliasData { | |||
17 | pub(crate) type_ref: Option<TypeRef>, | 17 | pub(crate) type_ref: Option<TypeRef>, |
18 | } | 18 | } |
19 | 19 | ||
20 | pub(crate) fn type_alias_data_query( | 20 | impl TypeAliasData { |
21 | db: &(impl DefDatabase + AstDatabase), | 21 | pub(crate) fn type_alias_data_query( |
22 | typ: TypeAlias, | 22 | db: &(impl DefDatabase + AstDatabase), |
23 | ) -> Arc<TypeAliasData> { | 23 | typ: TypeAlias, |
24 | let node = typ.source(db).ast; | 24 | ) -> Arc<TypeAliasData> { |
25 | let name = node.name().map_or_else(Name::missing, |n| n.as_name()); | 25 | let node = typ.source(db).ast; |
26 | let type_ref = node.type_ref().map(TypeRef::from_ast); | 26 | let name = node.name().map_or_else(Name::missing, |n| n.as_name()); |
27 | Arc::new(TypeAliasData { name, type_ref }) | 27 | let type_ref = node.type_ref().map(TypeRef::from_ast); |
28 | Arc::new(TypeAliasData { name, type_ref }) | ||
29 | } | ||
28 | } | 30 | } |
diff --git a/crates/ra_hir/src/util.rs b/crates/ra_hir/src/util.rs new file mode 100644 index 000000000..0095ee45d --- /dev/null +++ b/crates/ra_hir/src/util.rs | |||
@@ -0,0 +1,12 @@ | |||
1 | //! Internal utility functions. | ||
2 | |||
3 | use std::sync::Arc; | ||
4 | |||
5 | /// Helper for mutating `Arc<[T]>` (i.e. `Arc::make_mut` for Arc slices). | ||
6 | /// The underlying values are cloned if there are other strong references. | ||
7 | pub(crate) fn make_mut_slice<T: Clone>(a: &mut Arc<[T]>) -> &mut [T] { | ||
8 | if Arc::get_mut(a).is_none() { | ||
9 | *a = a.iter().cloned().collect(); | ||
10 | } | ||
11 | Arc::get_mut(a).unwrap() | ||
12 | } | ||
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs index 09913787b..050249c0e 100644 --- a/crates/ra_ide_api/src/change.rs +++ b/crates/ra_ide_api/src/change.rs | |||
@@ -4,7 +4,7 @@ use std::{fmt, sync::Arc, time}; | |||
4 | 4 | ||
5 | use ra_db::{ | 5 | use ra_db::{ |
6 | salsa::{Database, Durability, SweepStrategy}, | 6 | salsa::{Database, Durability, SweepStrategy}, |
7 | CrateGraph, CrateId, FileId, SourceDatabase, SourceRoot, SourceRootId, | 7 | CrateGraph, CrateId, FileId, SourceDatabase, SourceDatabaseExt, SourceRoot, SourceRootId, |
8 | }; | 8 | }; |
9 | use ra_prof::{memory_usage, profile, Bytes}; | 9 | use ra_prof::{memory_usage, profile, Bytes}; |
10 | use ra_syntax::SourceFile; | 10 | use ra_syntax::SourceFile; |
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs index ea0714add..bbf04bcf7 100644 --- a/crates/ra_ide_api/src/db.rs +++ b/crates/ra_ide_api/src/db.rs | |||
@@ -4,8 +4,10 @@ use std::sync::Arc; | |||
4 | 4 | ||
5 | use ra_db::{ | 5 | use ra_db::{ |
6 | salsa::{self, Database, Durability}, | 6 | salsa::{self, Database, Durability}, |
7 | Canceled, CheckCanceled, CrateId, FileId, SourceDatabase, SourceRootId, | 7 | Canceled, CheckCanceled, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, |
8 | SourceDatabaseExt, SourceRootId, | ||
8 | }; | 9 | }; |
10 | use relative_path::RelativePath; | ||
9 | use rustc_hash::FxHashMap; | 11 | use rustc_hash::FxHashMap; |
10 | 12 | ||
11 | use crate::{ | 13 | use crate::{ |
@@ -15,6 +17,7 @@ use crate::{ | |||
15 | 17 | ||
16 | #[salsa::database( | 18 | #[salsa::database( |
17 | ra_db::SourceDatabaseStorage, | 19 | ra_db::SourceDatabaseStorage, |
20 | ra_db::SourceDatabaseExtStorage, | ||
18 | LineIndexDatabaseStorage, | 21 | LineIndexDatabaseStorage, |
19 | symbol_index::SymbolsDatabaseStorage, | 22 | symbol_index::SymbolsDatabaseStorage, |
20 | hir::db::InternDatabaseStorage, | 23 | hir::db::InternDatabaseStorage, |
@@ -31,6 +34,22 @@ pub(crate) struct RootDatabase { | |||
31 | pub(crate) last_gc_check: crate::wasm_shims::Instant, | 34 | pub(crate) last_gc_check: crate::wasm_shims::Instant, |
32 | } | 35 | } |
33 | 36 | ||
37 | impl FileLoader for RootDatabase { | ||
38 | fn file_text(&self, file_id: FileId) -> Arc<String> { | ||
39 | FileLoaderDelegate(self).file_text(file_id) | ||
40 | } | ||
41 | fn resolve_relative_path( | ||
42 | &self, | ||
43 | anchor: FileId, | ||
44 | relative_path: &RelativePath, | ||
45 | ) -> Option<FileId> { | ||
46 | FileLoaderDelegate(self).resolve_relative_path(anchor, relative_path) | ||
47 | } | ||
48 | fn relevant_crates(&self, file_id: FileId) -> Arc<Vec<CrateId>> { | ||
49 | FileLoaderDelegate(self).relevant_crates(file_id) | ||
50 | } | ||
51 | } | ||
52 | |||
34 | impl hir::debug::HirDebugHelper for RootDatabase { | 53 | impl hir::debug::HirDebugHelper for RootDatabase { |
35 | fn crate_name(&self, krate: CrateId) -> Option<String> { | 54 | fn crate_name(&self, krate: CrateId) -> Option<String> { |
36 | self.debug_data.crate_names.get(&krate).cloned() | 55 | self.debug_data.crate_names.get(&krate).cloned() |
@@ -104,7 +123,7 @@ pub(crate) trait LineIndexDatabase: ra_db::SourceDatabase + CheckCanceled { | |||
104 | fn line_index(&self, file_id: FileId) -> Arc<LineIndex>; | 123 | fn line_index(&self, file_id: FileId) -> Arc<LineIndex>; |
105 | } | 124 | } |
106 | 125 | ||
107 | fn line_index(db: &impl ra_db::SourceDatabase, file_id: FileId) -> Arc<LineIndex> { | 126 | fn line_index(db: &impl LineIndexDatabase, file_id: FileId) -> Arc<LineIndex> { |
108 | let text = db.file_text(file_id); | 127 | let text = db.file_text(file_id); |
109 | Arc::new(LineIndex::new(&*text)) | 128 | Arc::new(LineIndex::new(&*text)) |
110 | } | 129 | } |
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 65f061443..8743a3a79 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs | |||
@@ -4,7 +4,7 @@ use std::cell::RefCell; | |||
4 | 4 | ||
5 | use hir::diagnostics::{AstDiagnostic, Diagnostic as _, DiagnosticSink}; | 5 | use hir::diagnostics::{AstDiagnostic, Diagnostic as _, DiagnosticSink}; |
6 | use itertools::Itertools; | 6 | use itertools::Itertools; |
7 | use ra_db::SourceDatabase; | 7 | use ra_db::{SourceDatabase, SourceDatabaseExt}; |
8 | use ra_prof::profile; | 8 | use ra_prof::profile; |
9 | use ra_syntax::{ | 9 | use ra_syntax::{ |
10 | algo, | 10 | algo, |
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 2d92fe1c5..f7fd42f65 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -52,7 +52,7 @@ use std::sync::Arc; | |||
52 | use ra_cfg::CfgOptions; | 52 | use ra_cfg::CfgOptions; |
53 | use ra_db::{ | 53 | use ra_db::{ |
54 | salsa::{self, ParallelDatabase}, | 54 | salsa::{self, ParallelDatabase}, |
55 | CheckCanceled, SourceDatabase, | 55 | CheckCanceled, FileLoader, SourceDatabase, |
56 | }; | 56 | }; |
57 | use ra_syntax::{SourceFile, TextRange, TextUnit}; | 57 | use ra_syntax::{SourceFile, TextRange, TextUnit}; |
58 | use ra_text_edit::TextEdit; | 58 | use ra_text_edit::TextEdit; |
@@ -289,10 +289,14 @@ impl AnalysisHost { | |||
289 | pub fn per_query_memory_usage(&mut self) -> Vec<(String, ra_prof::Bytes)> { | 289 | pub fn per_query_memory_usage(&mut self) -> Vec<(String, ra_prof::Bytes)> { |
290 | self.db.per_query_memory_usage() | 290 | self.db.per_query_memory_usage() |
291 | } | 291 | } |
292 | pub fn raw_database(&self) -> &(impl hir::db::HirDatabase + salsa::Database) { | 292 | pub fn raw_database( |
293 | &self, | ||
294 | ) -> &(impl hir::db::HirDatabase + salsa::Database + ra_db::SourceDatabaseExt) { | ||
293 | &self.db | 295 | &self.db |
294 | } | 296 | } |
295 | pub fn raw_database_mut(&mut self) -> &mut (impl hir::db::HirDatabase + salsa::Database) { | 297 | pub fn raw_database_mut( |
298 | &mut self, | ||
299 | ) -> &mut (impl hir::db::HirDatabase + salsa::Database + ra_db::SourceDatabaseExt) { | ||
296 | &mut self.db | 300 | &mut self.db |
297 | } | 301 | } |
298 | } | 302 | } |
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs index c95c47bf1..4247c6d90 100644 --- a/crates/ra_ide_api/src/references.rs +++ b/crates/ra_ide_api/src/references.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use hir::{Either, ModuleSource}; | 3 | use hir::{Either, ModuleSource}; |
4 | use ra_db::SourceDatabase; | 4 | use ra_db::{SourceDatabase, SourceDatabaseExt}; |
5 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode}; | 5 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode}; |
6 | use relative_path::{RelativePath, RelativePathBuf}; | 6 | use relative_path::{RelativePath, RelativePathBuf}; |
7 | 7 | ||
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs index 797e9926f..5729eb5b3 100644 --- a/crates/ra_ide_api/src/symbol_index.rs +++ b/crates/ra_ide_api/src/symbol_index.rs | |||
@@ -29,7 +29,7 @@ use std::{ | |||
29 | use fst::{self, Streamer}; | 29 | use fst::{self, Streamer}; |
30 | use ra_db::{ | 30 | use ra_db::{ |
31 | salsa::{self, ParallelDatabase}, | 31 | salsa::{self, ParallelDatabase}, |
32 | SourceDatabase, SourceRootId, | 32 | SourceDatabaseExt, SourceRootId, |
33 | }; | 33 | }; |
34 | use ra_syntax::{ | 34 | use ra_syntax::{ |
35 | ast::{self, NameOwner}, | 35 | ast::{self, NameOwner}, |
diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml index aedc55a95..46a0f958c 100644 --- a/crates/ra_lsp_server/Cargo.toml +++ b/crates/ra_lsp_server/Cargo.toml | |||
@@ -18,8 +18,6 @@ parking_lot = "0.9.0" | |||
18 | jod-thread = "0.1.0" | 18 | jod-thread = "0.1.0" |
19 | ra_vfs = "0.4.0" | 19 | ra_vfs = "0.4.0" |
20 | ra_syntax = { path = "../ra_syntax" } | 20 | ra_syntax = { path = "../ra_syntax" } |
21 | ra_db = { path = "../ra_db" } | ||
22 | ra_cfg = { path = "../ra_cfg" } | ||
23 | ra_text_edit = { path = "../ra_text_edit" } | 21 | ra_text_edit = { path = "../ra_text_edit" } |
24 | ra_ide_api = { path = "../ra_ide_api" } | 22 | ra_ide_api = { path = "../ra_ide_api" } |
25 | lsp-server = "0.2.0" | 23 | lsp-server = "0.2.0" |
diff --git a/crates/ra_lsp_server/src/lib.rs b/crates/ra_lsp_server/src/lib.rs index 7a71a90fb..0e5dbbbd5 100644 --- a/crates/ra_lsp_server/src/lib.rs +++ b/crates/ra_lsp_server/src/lib.rs | |||
@@ -7,7 +7,7 @@ mod conv; | |||
7 | mod main_loop; | 7 | mod main_loop; |
8 | mod markdown; | 8 | mod markdown; |
9 | pub mod req; | 9 | pub mod req; |
10 | pub mod config; | 10 | mod config; |
11 | mod world; | 11 | mod world; |
12 | 12 | ||
13 | pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>; | 13 | pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>; |
diff --git a/crates/ra_mbe/Cargo.toml b/crates/ra_mbe/Cargo.toml index b058dde91..e8ef2457b 100644 --- a/crates/ra_mbe/Cargo.toml +++ b/crates/ra_mbe/Cargo.toml | |||
@@ -8,7 +8,6 @@ authors = ["rust-analyzer developers"] | |||
8 | ra_syntax = { path = "../ra_syntax" } | 8 | ra_syntax = { path = "../ra_syntax" } |
9 | ra_parser = { path = "../ra_parser" } | 9 | ra_parser = { path = "../ra_parser" } |
10 | tt = { path = "../ra_tt", package = "ra_tt" } | 10 | tt = { path = "../ra_tt", package = "ra_tt" } |
11 | itertools = "0.8.0" | ||
12 | rustc-hash = "1.0.0" | 11 | rustc-hash = "1.0.0" |
13 | smallvec = "0.6.9" | 12 | smallvec = "0.6.9" |
14 | log = "0.4.5" | 13 | log = "0.4.5" |
diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml index 9bc85404a..68c594202 100644 --- a/crates/ra_syntax/Cargo.toml +++ b/crates/ra_syntax/Cargo.toml | |||
@@ -15,6 +15,7 @@ rustc-hash = "1.0.1" | |||
15 | arrayvec = "0.4.10" | 15 | arrayvec = "0.4.10" |
16 | once_cell = "1.2.0" | 16 | once_cell = "1.2.0" |
17 | 17 | ||
18 | # This crate transitively depends on `smol_str` via `rowan`. | ||
18 | # ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here | 19 | # ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here |
19 | # to reduce number of compilations | 20 | # to reduce number of compilations |
20 | smol_str = { version = "0.1.12", features = ["serde"] } | 21 | smol_str = { version = "0.1.12", features = ["serde"] } |
diff --git a/crates/ra_tt/Cargo.toml b/crates/ra_tt/Cargo.toml index 3328d312f..3fcc7f085 100644 --- a/crates/ra_tt/Cargo.toml +++ b/crates/ra_tt/Cargo.toml | |||
@@ -5,4 +5,6 @@ version = "0.1.0" | |||
5 | authors = ["rust-analyzer developers"] | 5 | authors = ["rust-analyzer developers"] |
6 | 6 | ||
7 | [dependencies] | 7 | [dependencies] |
8 | smol_str = "0.1.9" | 8 | # ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here |
9 | # to reduce number of compilations | ||
10 | smol_str = { version = "0.1.12", features = ["serde"] } | ||
diff --git a/docs/dev/README.md b/docs/dev/README.md index 0db3e731e..5e18e4ffe 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md | |||
@@ -14,7 +14,7 @@ To learn more about how rust-analyzer works, see | |||
14 | 14 | ||
15 | We also publish rustdoc docs to pages: | 15 | We also publish rustdoc docs to pages: |
16 | 16 | ||
17 | https://rust-analyzer.github.io/rust-analyzer/ra_ide_api/index.html | 17 | https://rust-analyzer.github.io/rust-analyzer/api-docs/ra_ide_api/ |
18 | 18 | ||
19 | Various organizational and process issues are discussed in this document. | 19 | Various organizational and process issues are discussed in this document. |
20 | 20 | ||