aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/hir/src/semantics.rs10
-rw-r--r--crates/hir_expand/src/db.rs14
-rw-r--r--crates/hir_ty/Cargo.toml6
-rw-r--r--crates/hir_ty/src/lower.rs2
-rw-r--r--crates/ide/src/doc_links.rs6
-rw-r--r--crates/ide_completion/src/context.rs20
-rw-r--r--crates/ide_completion/src/lib.rs4
-rw-r--r--crates/proc_macro_api/Cargo.toml2
-rw-r--r--crates/proc_macro_srv/Cargo.toml2
-rw-r--r--crates/proc_macro_srv/src/dylib.rs2
-rw-r--r--crates/proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt2
-rw-r--r--crates/project_model/src/cargo_workspace.rs36
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt11
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt2
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt7
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt2
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt2
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt5
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt5
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt5
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt6
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt11
-rw-r--r--crates/rust-analyzer/src/to_proto.rs2
-rw-r--r--crates/syntax/Cargo.toml2
24 files changed, 114 insertions, 52 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 3aa467e3c..8d3c43d08 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -120,10 +120,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
120 pub fn speculative_expand( 120 pub fn speculative_expand(
121 &self, 121 &self,
122 actual_macro_call: &ast::MacroCall, 122 actual_macro_call: &ast::MacroCall,
123 hypothetical_args: &ast::TokenTree, 123 speculative_args: &ast::TokenTree,
124 token_to_map: SyntaxToken, 124 token_to_map: SyntaxToken,
125 ) -> Option<(SyntaxNode, SyntaxToken)> { 125 ) -> Option<(SyntaxNode, SyntaxToken)> {
126 self.imp.speculative_expand(actual_macro_call, hypothetical_args, token_to_map) 126 self.imp.speculative_expand(actual_macro_call, speculative_args, token_to_map)
127 } 127 }
128 128
129 pub fn descend_into_macros(&self, token: SyntaxToken) -> SyntaxToken { 129 pub fn descend_into_macros(&self, token: SyntaxToken) -> SyntaxToken {
@@ -335,7 +335,7 @@ impl<'db> SemanticsImpl<'db> {
335 fn speculative_expand( 335 fn speculative_expand(
336 &self, 336 &self,
337 actual_macro_call: &ast::MacroCall, 337 actual_macro_call: &ast::MacroCall,
338 hypothetical_args: &ast::TokenTree, 338 speculative_args: &ast::TokenTree,
339 token_to_map: SyntaxToken, 339 token_to_map: SyntaxToken,
340 ) -> Option<(SyntaxNode, SyntaxToken)> { 340 ) -> Option<(SyntaxNode, SyntaxToken)> {
341 let sa = self.analyze(actual_macro_call.syntax()); 341 let sa = self.analyze(actual_macro_call.syntax());
@@ -344,10 +344,10 @@ impl<'db> SemanticsImpl<'db> {
344 let macro_call_id = macro_call.as_call_id(self.db.upcast(), krate, |path| { 344 let macro_call_id = macro_call.as_call_id(self.db.upcast(), krate, |path| {
345 sa.resolver.resolve_path_as_macro(self.db.upcast(), &path) 345 sa.resolver.resolve_path_as_macro(self.db.upcast(), &path)
346 })?; 346 })?;
347 hir_expand::db::expand_hypothetical( 347 hir_expand::db::expand_speculative(
348 self.db.upcast(), 348 self.db.upcast(),
349 macro_call_id, 349 macro_call_id,
350 hypothetical_args, 350 speculative_args,
351 token_to_map, 351 token_to_map,
352 ) 352 )
353 } 353 }
diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs
index 03637878b..625c26f0a 100644
--- a/crates/hir_expand/src/db.rs
+++ b/crates/hir_expand/src/db.rs
@@ -131,15 +131,15 @@ pub trait AstDatabase: SourceDatabase {
131/// used for completion, where we want to see what 'would happen' if we insert a 131/// used for completion, where we want to see what 'would happen' if we insert a
132/// token. The `token_to_map` mapped down into the expansion, with the mapped 132/// token. The `token_to_map` mapped down into the expansion, with the mapped
133/// token returned. 133/// token returned.
134pub fn expand_hypothetical( 134pub fn expand_speculative(
135 db: &dyn AstDatabase, 135 db: &dyn AstDatabase,
136 actual_macro_call: MacroCallId, 136 actual_macro_call: MacroCallId,
137 hypothetical_args: &ast::TokenTree, 137 speculative_args: &ast::TokenTree,
138 token_to_map: SyntaxToken, 138 token_to_map: SyntaxToken,
139) -> Option<(SyntaxNode, SyntaxToken)> { 139) -> Option<(SyntaxNode, SyntaxToken)> {
140 let (tt, tmap_1) = mbe::syntax_node_to_token_tree(hypothetical_args.syntax()); 140 let (tt, tmap_1) = mbe::syntax_node_to_token_tree(speculative_args.syntax());
141 let range = 141 let range =
142 token_to_map.text_range().checked_sub(hypothetical_args.syntax().text_range().start())?; 142 token_to_map.text_range().checked_sub(speculative_args.syntax().text_range().start())?;
143 let token_id = tmap_1.token_by_range(range)?; 143 let token_id = tmap_1.token_by_range(range)?;
144 144
145 let macro_def = { 145 let macro_def = {
@@ -147,12 +147,12 @@ pub fn expand_hypothetical(
147 db.macro_def(loc.def)? 147 db.macro_def(loc.def)?
148 }; 148 };
149 149
150 let hypothetical_expansion = macro_def.expand(db, actual_macro_call, &tt); 150 let speculative_expansion = macro_def.expand(db, actual_macro_call, &tt);
151 151
152 let fragment_kind = macro_fragment_kind(db, actual_macro_call); 152 let fragment_kind = macro_fragment_kind(db, actual_macro_call);
153 153
154 let (node, tmap_2) = 154 let (node, tmap_2) =
155 mbe::token_tree_to_syntax_node(&hypothetical_expansion.value, fragment_kind).ok()?; 155 mbe::token_tree_to_syntax_node(&speculative_expansion.value, fragment_kind).ok()?;
156 156
157 let token_id = macro_def.map_id_down(token_id); 157 let token_id = macro_def.map_id_down(token_id);
158 let range = tmap_2.range_by_token(token_id, token_to_map.kind())?; 158 let range = tmap_2.range_by_token(token_id, token_to_map.kind())?;
@@ -325,7 +325,7 @@ fn macro_expand_with_arg(
325 if let Some(eager) = &loc.eager { 325 if let Some(eager) = &loc.eager {
326 if arg.is_some() { 326 if arg.is_some() {
327 return ExpandResult::str_err( 327 return ExpandResult::str_err(
328 "hypothetical macro expansion not implemented for eager macro".to_owned(), 328 "speculative macro expansion not implemented for eager macro".to_owned(),
329 ); 329 );
330 } else { 330 } else {
331 return ExpandResult { 331 return ExpandResult {
diff --git a/crates/hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml
index 66b3418f2..a9994082a 100644
--- a/crates/hir_ty/Cargo.toml
+++ b/crates/hir_ty/Cargo.toml
@@ -18,9 +18,9 @@ ena = "0.14.0"
18log = "0.4.8" 18log = "0.4.8"
19rustc-hash = "1.1.0" 19rustc-hash = "1.1.0"
20scoped-tls = "1" 20scoped-tls = "1"
21chalk-solve = { version = "0.64", default-features = false } 21chalk-solve = { version = "0.67", default-features = false }
22chalk-ir = "0.64" 22chalk-ir = "0.67"
23chalk-recursive = "0.64" 23chalk-recursive = "0.67"
24la-arena = { version = "0.2.0", path = "../../lib/arena" } 24la-arena = { version = "0.2.0", path = "../../lib/arena" }
25 25
26stdx = { path = "../stdx", version = "0.0.0" } 26stdx = { path = "../stdx", version = "0.0.0" }
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index 1645ac533..c83933c73 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -1026,7 +1026,7 @@ pub(crate) fn trait_environment_query(
1026 }; 1026 };
1027 if let Some(AssocContainerId::TraitId(trait_id)) = container { 1027 if let Some(AssocContainerId::TraitId(trait_id)) = container {
1028 // add `Self: Trait<T1, T2, ...>` to the environment in trait 1028 // add `Self: Trait<T1, T2, ...>` to the environment in trait
1029 // function default implementations (and hypothetical code 1029 // function default implementations (and speculative code
1030 // inside consts or type aliases) 1030 // inside consts or type aliases)
1031 cov_mark::hit!(trait_self_implements_self); 1031 cov_mark::hit!(trait_self_implements_self);
1032 let substs = TyBuilder::type_params_subst(db, trait_id); 1032 let substs = TyBuilder::type_params_subst(db, trait_id);
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs
index 320694a17..ec3828ab2 100644
--- a/crates/ide/src/doc_links.rs
+++ b/crates/ide/src/doc_links.rs
@@ -286,7 +286,7 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option<String> {
286 .and_then( 286 .and_then(
287 |url| if let Some(fragment) = fragment { url.join(&fragment).ok() } else { Some(url) }, 287 |url| if let Some(fragment) = fragment { url.join(&fragment).ok() } else { Some(url) },
288 ) 288 )
289 .map(|url| url.into_string()) 289 .map(|url| url.into())
290} 290}
291 291
292fn rewrite_intra_doc_link( 292fn rewrite_intra_doc_link(
@@ -325,7 +325,7 @@ fn rewrite_intra_doc_link(
325 }; 325 };
326 } 326 }
327 327
328 Some((new_url.into_string(), strip_prefixes_suffixes(title).to_string())) 328 Some((new_url.into(), strip_prefixes_suffixes(title).to_string()))
329} 329}
330 330
331/// Try to resolve path to local documentation via path-based links (i.e. `../gateway/struct.Shard.html`). 331/// Try to resolve path to local documentation via path-based links (i.e. `../gateway/struct.Shard.html`).
@@ -345,7 +345,7 @@ fn rewrite_url_link(db: &RootDatabase, def: ModuleDef, target: &str) -> Option<S
345 get_symbol_filename(db, &def).as_deref().map(|f| url.join(f).ok()).flatten() 345 get_symbol_filename(db, &def).as_deref().map(|f| url.join(f).ok()).flatten()
346 }) 346 })
347 .and_then(|url| url.join(target).ok()) 347 .and_then(|url| url.join(target).ok())
348 .map(|url| url.into_string()) 348 .map(|url| url.into())
349} 349}
350 350
351/// Rewrites a markdown document, applying 'callback' to each link. 351/// Rewrites a markdown document, applying 'callback' to each link.
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs
index 1ec59ff80..2f3fb1710 100644
--- a/crates/ide_completion/src/context.rs
+++ b/crates/ide_completion/src/context.rs
@@ -196,46 +196,46 @@ impl<'a> CompletionContext<'a> {
196 }; 196 };
197 197
198 let mut original_file = original_file.syntax().clone(); 198 let mut original_file = original_file.syntax().clone();
199 let mut hypothetical_file = file_with_fake_ident.syntax().clone(); 199 let mut speculative_file = file_with_fake_ident.syntax().clone();
200 let mut offset = position.offset; 200 let mut offset = position.offset;
201 let mut fake_ident_token = fake_ident_token; 201 let mut fake_ident_token = fake_ident_token;
202 202
203 // Are we inside a macro call? 203 // Are we inside a macro call?
204 while let (Some(actual_macro_call), Some(macro_call_with_fake_ident)) = ( 204 while let (Some(actual_macro_call), Some(macro_call_with_fake_ident)) = (
205 find_node_at_offset::<ast::MacroCall>(&original_file, offset), 205 find_node_at_offset::<ast::MacroCall>(&original_file, offset),
206 find_node_at_offset::<ast::MacroCall>(&hypothetical_file, offset), 206 find_node_at_offset::<ast::MacroCall>(&speculative_file, offset),
207 ) { 207 ) {
208 if actual_macro_call.path().as_ref().map(|s| s.syntax().text()) 208 if actual_macro_call.path().as_ref().map(|s| s.syntax().text())
209 != macro_call_with_fake_ident.path().as_ref().map(|s| s.syntax().text()) 209 != macro_call_with_fake_ident.path().as_ref().map(|s| s.syntax().text())
210 { 210 {
211 break; 211 break;
212 } 212 }
213 let hypothetical_args = match macro_call_with_fake_ident.token_tree() { 213 let speculative_args = match macro_call_with_fake_ident.token_tree() {
214 Some(tt) => tt, 214 Some(tt) => tt,
215 None => break, 215 None => break,
216 }; 216 };
217 if let (Some(actual_expansion), Some(hypothetical_expansion)) = ( 217 if let (Some(actual_expansion), Some(speculative_expansion)) = (
218 ctx.sema.expand(&actual_macro_call), 218 ctx.sema.expand(&actual_macro_call),
219 ctx.sema.speculative_expand( 219 ctx.sema.speculative_expand(
220 &actual_macro_call, 220 &actual_macro_call,
221 &hypothetical_args, 221 &speculative_args,
222 fake_ident_token, 222 fake_ident_token,
223 ), 223 ),
224 ) { 224 ) {
225 let new_offset = hypothetical_expansion.1.text_range().start(); 225 let new_offset = speculative_expansion.1.text_range().start();
226 if new_offset > actual_expansion.text_range().end() { 226 if new_offset > actual_expansion.text_range().end() {
227 break; 227 break;
228 } 228 }
229 original_file = actual_expansion; 229 original_file = actual_expansion;
230 hypothetical_file = hypothetical_expansion.0; 230 speculative_file = speculative_expansion.0;
231 fake_ident_token = hypothetical_expansion.1; 231 fake_ident_token = speculative_expansion.1;
232 offset = new_offset; 232 offset = new_offset;
233 } else { 233 } else {
234 break; 234 break;
235 } 235 }
236 } 236 }
237 ctx.fill_keyword_patterns(&hypothetical_file, offset); 237 ctx.fill_keyword_patterns(&speculative_file, offset);
238 ctx.fill(&original_file, hypothetical_file, offset); 238 ctx.fill(&original_file, speculative_file, offset);
239 Some(ctx) 239 Some(ctx)
240 } 240 }
241 241
diff --git a/crates/ide_completion/src/lib.rs b/crates/ide_completion/src/lib.rs
index 645349215..1152a9850 100644
--- a/crates/ide_completion/src/lib.rs
+++ b/crates/ide_completion/src/lib.rs
@@ -107,7 +107,7 @@ pub use crate::{
107/// identifier prefix/fuzzy match should be done higher in the stack, together 107/// identifier prefix/fuzzy match should be done higher in the stack, together
108/// with ordering of completions (currently this is done by the client). 108/// with ordering of completions (currently this is done by the client).
109/// 109///
110/// # Hypothetical Completion Problem 110/// # Speculative Completion Problem
111/// 111///
112/// There's a curious unsolved problem in the current implementation. Often, you 112/// There's a curious unsolved problem in the current implementation. Often, you
113/// want to compute completions on a *slightly different* text document. 113/// want to compute completions on a *slightly different* text document.
@@ -121,7 +121,7 @@ pub use crate::{
121/// doesn't allow such "phantom" inputs. 121/// doesn't allow such "phantom" inputs.
122/// 122///
123/// Another case where this would be instrumental is macro expansion. We want to 123/// Another case where this would be instrumental is macro expansion. We want to
124/// insert a fake ident and re-expand code. There's `expand_hypothetical` as a 124/// insert a fake ident and re-expand code. There's `expand_speculative` as a
125/// work-around for this. 125/// work-around for this.
126/// 126///
127/// A different use-case is completion of injection (examples and links in doc 127/// A different use-case is completion of injection (examples and links in doc
diff --git a/crates/proc_macro_api/Cargo.toml b/crates/proc_macro_api/Cargo.toml
index 2ce5eeedd..2c4da394b 100644
--- a/crates/proc_macro_api/Cargo.toml
+++ b/crates/proc_macro_api/Cargo.toml
@@ -16,7 +16,7 @@ log = "0.4.8"
16crossbeam-channel = "0.5.0" 16crossbeam-channel = "0.5.0"
17jod-thread = "0.1.1" 17jod-thread = "0.1.1"
18memmap2 = "0.2.0" 18memmap2 = "0.2.0"
19object = { version = "0.23.0", default-features = false, features = ["std", "read_core", "elf", "macho", "pe", "unaligned"] } 19object = { version = "0.24", default-features = false, features = ["std", "read_core", "elf", "macho", "pe"] }
20snap = "1.0" 20snap = "1.0"
21 21
22tt = { path = "../tt", version = "0.0.0" } 22tt = { path = "../tt", version = "0.0.0" }
diff --git a/crates/proc_macro_srv/Cargo.toml b/crates/proc_macro_srv/Cargo.toml
index 63b3f1532..4ea41175e 100644
--- a/crates/proc_macro_srv/Cargo.toml
+++ b/crates/proc_macro_srv/Cargo.toml
@@ -10,7 +10,7 @@ edition = "2018"
10doctest = false 10doctest = false
11 11
12[dependencies] 12[dependencies]
13object = { version = "0.23", default-features = false, features = ["std", "read_core", "elf", "macho", "pe"] } 13object = { version = "0.24", default-features = false, features = ["std", "read_core", "elf", "macho", "pe"] }
14libloading = "0.7.0" 14libloading = "0.7.0"
15memmap2 = "0.2.0" 15memmap2 = "0.2.0"
16 16
diff --git a/crates/proc_macro_srv/src/dylib.rs b/crates/proc_macro_srv/src/dylib.rs
index baf10fea9..cccc53220 100644
--- a/crates/proc_macro_srv/src/dylib.rs
+++ b/crates/proc_macro_srv/src/dylib.rs
@@ -27,7 +27,7 @@ fn find_registrar_symbol(file: &Path) -> io::Result<Option<String>> {
27 let file = File::open(file)?; 27 let file = File::open(file)?;
28 let buffer = unsafe { Mmap::map(&file)? }; 28 let buffer = unsafe { Mmap::map(&file)? };
29 29
30 Ok(object::File::parse(&buffer) 30 Ok(object::File::parse(&*buffer)
31 .map_err(invalid_data_err)? 31 .map_err(invalid_data_err)?
32 .exports() 32 .exports()
33 .map_err(invalid_data_err)? 33 .map_err(invalid_data_err)?
diff --git a/crates/proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt b/crates/proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
index fa581f110..eb67c7134 100644
--- a/crates/proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
+++ b/crates/proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
@@ -23,7 +23,7 @@ SUBTREE $
23 SUBTREE [] 4294967295 23 SUBTREE [] 4294967295
24 IDENT allow 4294967295 24 IDENT allow 4294967295
25 SUBTREE () 4294967295 25 SUBTREE () 4294967295
26 IDENT rust_2018_idioms 4294967295 26 IDENT unused_extern_crates 4294967295
27 PUNCH , [alone] 4294967295 27 PUNCH , [alone] 4294967295
28 IDENT clippy 4294967295 28 IDENT clippy 4294967295
29 PUNCH : [joint] 4294967295 29 PUNCH : [joint] 4294967295
diff --git a/crates/project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs
index ad705c752..a8fee4f08 100644
--- a/crates/project_model/src/cargo_workspace.rs
+++ b/crates/project_model/src/cargo_workspace.rs
@@ -121,7 +121,7 @@ pub struct PackageDependency {
121 pub kind: DepKind, 121 pub kind: DepKind,
122} 122}
123 123
124#[derive(Debug, Clone, Eq, PartialEq)] 124#[derive(Debug, Clone, Eq, PartialEq, PartialOrd, Ord)]
125pub enum DepKind { 125pub enum DepKind {
126 /// Available to the library, binary, and dev targets in the package (but not the build script). 126 /// Available to the library, binary, and dev targets in the package (but not the build script).
127 Normal, 127 Normal,
@@ -132,17 +132,23 @@ pub enum DepKind {
132} 132}
133 133
134impl DepKind { 134impl DepKind {
135 fn new(list: &[cargo_metadata::DepKindInfo]) -> Self { 135 fn iter(list: &[cargo_metadata::DepKindInfo]) -> impl Iterator<Item = Self> + '_ {
136 let mut dep_kinds = Vec::new();
137 if list.is_empty() {
138 dep_kinds.push(Self::Normal);
139 }
136 for info in list { 140 for info in list {
137 match info.kind { 141 let kind = match info.kind {
138 cargo_metadata::DependencyKind::Normal => return Self::Normal, 142 cargo_metadata::DependencyKind::Normal => Self::Normal,
139 cargo_metadata::DependencyKind::Development => return Self::Dev, 143 cargo_metadata::DependencyKind::Development => Self::Dev,
140 cargo_metadata::DependencyKind::Build => return Self::Build, 144 cargo_metadata::DependencyKind::Build => Self::Build,
141 cargo_metadata::DependencyKind::Unknown => continue, 145 cargo_metadata::DependencyKind::Unknown => continue,
142 } 146 };
147 dep_kinds.push(kind);
143 } 148 }
144 149 dep_kinds.sort_unstable();
145 Self::Normal 150 dep_kinds.dedup();
151 dep_kinds.into_iter()
146 } 152 }
147} 153}
148 154
@@ -317,7 +323,11 @@ impl CargoWorkspace {
317 } 323 }
318 }; 324 };
319 node.deps.sort_by(|a, b| a.pkg.cmp(&b.pkg)); 325 node.deps.sort_by(|a, b| a.pkg.cmp(&b.pkg));
320 for dep_node in node.deps { 326 for (dep_node, kind) in node
327 .deps
328 .iter()
329 .flat_map(|dep| DepKind::iter(&dep.dep_kinds).map(move |kind| (dep, kind)))
330 {
321 let pkg = match pkg_by_id.get(&dep_node.pkg) { 331 let pkg = match pkg_by_id.get(&dep_node.pkg) {
322 Some(&pkg) => pkg, 332 Some(&pkg) => pkg,
323 None => { 333 None => {
@@ -328,11 +338,7 @@ impl CargoWorkspace {
328 continue; 338 continue;
329 } 339 }
330 }; 340 };
331 let dep = PackageDependency { 341 let dep = PackageDependency { name: dep_node.name.clone(), pkg, kind };
332 name: dep_node.name,
333 pkg,
334 kind: DepKind::new(&dep_node.dep_kinds),
335 };
336 packages[source].dependencies.push(dep); 342 packages[source].dependencies.push(dep);
337 } 343 }
338 packages[source].active_features.extend(node.features); 344 packages[source].active_features.extend(node.features);
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt b/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt
index 227d96d51..bcc889681 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt
@@ -2,6 +2,7 @@
2 MappedRustDiagnostic { 2 MappedRustDiagnostic {
3 url: Url { 3 url: Url {
4 scheme: "file", 4 scheme: "file",
5 cannot_be_a_base: false,
5 username: "", 6 username: "",
6 password: None, 7 password: None,
7 host: None, 8 host: None,
@@ -33,6 +34,7 @@
33 CodeDescription { 34 CodeDescription {
34 href: Url { 35 href: Url {
35 scheme: "https", 36 scheme: "https",
37 cannot_be_a_base: false,
36 username: "", 38 username: "",
37 password: None, 39 password: None,
38 host: Some( 40 host: Some(
@@ -59,6 +61,7 @@
59 location: Location { 61 location: Location {
60 uri: Url { 62 uri: Url {
61 scheme: "file", 63 scheme: "file",
64 cannot_be_a_base: false,
62 username: "", 65 username: "",
63 password: None, 66 password: None,
64 host: None, 67 host: None,
@@ -84,6 +87,7 @@
84 location: Location { 87 location: Location {
85 uri: Url { 88 uri: Url {
86 scheme: "file", 89 scheme: "file",
90 cannot_be_a_base: false,
87 username: "", 91 username: "",
88 password: None, 92 password: None,
89 host: None, 93 host: None,
@@ -115,6 +119,7 @@
115 MappedRustDiagnostic { 119 MappedRustDiagnostic {
116 url: Url { 120 url: Url {
117 scheme: "file", 121 scheme: "file",
122 cannot_be_a_base: false,
118 username: "", 123 username: "",
119 password: None, 124 password: None,
120 host: None, 125 host: None,
@@ -146,6 +151,7 @@
146 CodeDescription { 151 CodeDescription {
147 href: Url { 152 href: Url {
148 scheme: "https", 153 scheme: "https",
154 cannot_be_a_base: false,
149 username: "", 155 username: "",
150 password: None, 156 password: None,
151 host: Some( 157 host: Some(
@@ -172,6 +178,7 @@
172 location: Location { 178 location: Location {
173 uri: Url { 179 uri: Url {
174 scheme: "file", 180 scheme: "file",
181 cannot_be_a_base: false,
175 username: "", 182 username: "",
176 password: None, 183 password: None,
177 host: None, 184 host: None,
@@ -203,6 +210,7 @@
203 MappedRustDiagnostic { 210 MappedRustDiagnostic {
204 url: Url { 211 url: Url {
205 scheme: "file", 212 scheme: "file",
213 cannot_be_a_base: false,
206 username: "", 214 username: "",
207 password: None, 215 password: None,
208 host: None, 216 host: None,
@@ -234,6 +242,7 @@
234 CodeDescription { 242 CodeDescription {
235 href: Url { 243 href: Url {
236 scheme: "https", 244 scheme: "https",
245 cannot_be_a_base: false,
237 username: "", 246 username: "",
238 password: None, 247 password: None,
239 host: Some( 248 host: Some(
@@ -260,6 +269,7 @@
260 location: Location { 269 location: Location {
261 uri: Url { 270 uri: Url {
262 scheme: "file", 271 scheme: "file",
272 cannot_be_a_base: false,
263 username: "", 273 username: "",
264 password: None, 274 password: None,
265 host: None, 275 host: None,
@@ -301,6 +311,7 @@
301 { 311 {
302 Url { 312 Url {
303 scheme: "file", 313 scheme: "file",
314 cannot_be_a_base: false,
304 username: "", 315 username: "",
305 password: None, 316 password: None,
306 host: None, 317 host: None,
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt
index e5f01fb33..d5ab03576 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt
@@ -2,6 +2,7 @@
2 MappedRustDiagnostic { 2 MappedRustDiagnostic {
3 url: Url { 3 url: Url {
4 scheme: "file", 4 scheme: "file",
5 cannot_be_a_base: false,
5 username: "", 6 username: "",
6 password: None, 7 password: None,
7 host: None, 8 host: None,
@@ -33,6 +34,7 @@
33 CodeDescription { 34 CodeDescription {
34 href: Url { 35 href: Url {
35 scheme: "https", 36 scheme: "https",
37 cannot_be_a_base: false,
36 username: "", 38 username: "",
37 password: None, 39 password: None,
38 host: Some( 40 host: Some(
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt b/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt
index c847bbb35..8bee4cfe1 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt
@@ -2,6 +2,7 @@
2 MappedRustDiagnostic { 2 MappedRustDiagnostic {
3 url: Url { 3 url: Url {
4 scheme: "file", 4 scheme: "file",
5 cannot_be_a_base: false,
5 username: "", 6 username: "",
6 password: None, 7 password: None,
7 host: None, 8 host: None,
@@ -36,6 +37,7 @@
36 location: Location { 37 location: Location {
37 uri: Url { 38 uri: Url {
38 scheme: "file", 39 scheme: "file",
40 cannot_be_a_base: false,
39 username: "", 41 username: "",
40 password: None, 42 password: None,
41 host: None, 43 host: None,
@@ -67,6 +69,7 @@
67 MappedRustDiagnostic { 69 MappedRustDiagnostic {
68 url: Url { 70 url: Url {
69 scheme: "file", 71 scheme: "file",
72 cannot_be_a_base: false,
70 username: "", 73 username: "",
71 password: None, 74 password: None,
72 host: None, 75 host: None,
@@ -101,6 +104,7 @@
101 location: Location { 104 location: Location {
102 uri: Url { 105 uri: Url {
103 scheme: "file", 106 scheme: "file",
107 cannot_be_a_base: false,
104 username: "", 108 username: "",
105 password: None, 109 password: None,
106 host: None, 110 host: None,
@@ -132,6 +136,7 @@
132 MappedRustDiagnostic { 136 MappedRustDiagnostic {
133 url: Url { 137 url: Url {
134 scheme: "file", 138 scheme: "file",
139 cannot_be_a_base: false,
135 username: "", 140 username: "",
136 password: None, 141 password: None,
137 host: None, 142 host: None,
@@ -166,6 +171,7 @@
166 location: Location { 171 location: Location {
167 uri: Url { 172 uri: Url {
168 scheme: "file", 173 scheme: "file",
174 cannot_be_a_base: false,
169 username: "", 175 username: "",
170 password: None, 176 password: None,
171 host: None, 177 host: None,
@@ -191,6 +197,7 @@
191 location: Location { 197 location: Location {
192 uri: Url { 198 uri: Url {
193 scheme: "file", 199 scheme: "file",
200 cannot_be_a_base: false,
194 username: "", 201 username: "",
195 password: None, 202 password: None,
196 host: None, 203 host: None,
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt
index 0d16af232..ada540ea6 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt
@@ -2,6 +2,7 @@
2 MappedRustDiagnostic { 2 MappedRustDiagnostic {
3 url: Url { 3 url: Url {
4 scheme: "file", 4 scheme: "file",
5 cannot_be_a_base: false,
5 username: "", 6 username: "",
6 password: None, 7 password: None,
7 host: None, 8 host: None,
@@ -33,6 +34,7 @@
33 CodeDescription { 34 CodeDescription {
34 href: Url { 35 href: Url {
35 scheme: "https", 36 scheme: "https",
37 cannot_be_a_base: false,
36 username: "", 38 username: "",
37 password: None, 39 password: None,
38 host: Some( 40 host: Some(
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt
index 31b6a12ce..05074a914 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt
@@ -2,6 +2,7 @@
2 MappedRustDiagnostic { 2 MappedRustDiagnostic {
3 url: Url { 3 url: Url {
4 scheme: "file", 4 scheme: "file",
5 cannot_be_a_base: false,
5 username: "", 6 username: "",
6 password: None, 7 password: None,
7 host: None, 8 host: None,
@@ -33,6 +34,7 @@
33 CodeDescription { 34 CodeDescription {
34 href: Url { 35 href: Url {
35 scheme: "https", 36 scheme: "https",
37 cannot_be_a_base: false,
36 username: "", 38 username: "",
37 password: None, 39 password: None,
38 host: Some( 40 host: Some(
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt
index f8adfad3b..749f49438 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt
@@ -2,6 +2,7 @@
2 MappedRustDiagnostic { 2 MappedRustDiagnostic {
3 url: Url { 3 url: Url {
4 scheme: "file", 4 scheme: "file",
5 cannot_be_a_base: false,
5 username: "", 6 username: "",
6 password: None, 7 password: None,
7 host: None, 8 host: None,
@@ -40,6 +41,7 @@
40 location: Location { 41 location: Location {
41 uri: Url { 42 uri: Url {
42 scheme: "file", 43 scheme: "file",
44 cannot_be_a_base: false,
43 username: "", 45 username: "",
44 password: None, 46 password: None,
45 host: None, 47 host: None,
@@ -75,6 +77,7 @@
75 MappedRustDiagnostic { 77 MappedRustDiagnostic {
76 url: Url { 78 url: Url {
77 scheme: "file", 79 scheme: "file",
80 cannot_be_a_base: false,
78 username: "", 81 username: "",
79 password: None, 82 password: None,
80 host: None, 83 host: None,
@@ -113,6 +116,7 @@
113 location: Location { 116 location: Location {
114 uri: Url { 117 uri: Url {
115 scheme: "file", 118 scheme: "file",
119 cannot_be_a_base: false,
116 username: "", 120 username: "",
117 password: None, 121 password: None,
118 host: None, 122 host: None,
@@ -154,6 +158,7 @@
154 { 158 {
155 Url { 159 Url {
156 scheme: "file", 160 scheme: "file",
161 cannot_be_a_base: false,
157 username: "", 162 username: "",
158 password: None, 163 password: None,
159 host: None, 164 host: None,
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt
index 5a70d2ed7..d20a91b39 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt
@@ -2,6 +2,7 @@
2 MappedRustDiagnostic { 2 MappedRustDiagnostic {
3 url: Url { 3 url: Url {
4 scheme: "file", 4 scheme: "file",
5 cannot_be_a_base: false,
5 username: "", 6 username: "",
6 password: None, 7 password: None,
7 host: None, 8 host: None,
@@ -40,6 +41,7 @@
40 location: Location { 41 location: Location {
41 uri: Url { 42 uri: Url {
42 scheme: "file", 43 scheme: "file",
44 cannot_be_a_base: false,
43 username: "", 45 username: "",
44 password: None, 46 password: None,
45 host: None, 47 host: None,
@@ -75,6 +77,7 @@
75 MappedRustDiagnostic { 77 MappedRustDiagnostic {
76 url: Url { 78 url: Url {
77 scheme: "file", 79 scheme: "file",
80 cannot_be_a_base: false,
78 username: "", 81 username: "",
79 password: None, 82 password: None,
80 host: None, 83 host: None,
@@ -113,6 +116,7 @@
113 location: Location { 116 location: Location {
114 uri: Url { 117 uri: Url {
115 scheme: "file", 118 scheme: "file",
119 cannot_be_a_base: false,
116 username: "", 120 username: "",
117 password: None, 121 password: None,
118 host: None, 122 host: None,
@@ -154,6 +158,7 @@
154 { 158 {
155 Url { 159 Url {
156 scheme: "file", 160 scheme: "file",
161 cannot_be_a_base: false,
157 username: "", 162 username: "",
158 password: None, 163 password: None,
159 host: None, 164 host: None,
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt
index 04ca0c9c2..2a9c3a9af 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt
@@ -2,6 +2,7 @@
2 MappedRustDiagnostic { 2 MappedRustDiagnostic {
3 url: Url { 3 url: Url {
4 scheme: "file", 4 scheme: "file",
5 cannot_be_a_base: false,
5 username: "", 6 username: "",
6 password: None, 7 password: None,
7 host: None, 8 host: None,
@@ -40,6 +41,7 @@
40 location: Location { 41 location: Location {
41 uri: Url { 42 uri: Url {
42 scheme: "file", 43 scheme: "file",
44 cannot_be_a_base: false,
43 username: "", 45 username: "",
44 password: None, 46 password: None,
45 host: None, 47 host: None,
@@ -75,6 +77,7 @@
75 MappedRustDiagnostic { 77 MappedRustDiagnostic {
76 url: Url { 78 url: Url {
77 scheme: "file", 79 scheme: "file",
80 cannot_be_a_base: false,
78 username: "", 81 username: "",
79 password: None, 82 password: None,
80 host: None, 83 host: None,
@@ -113,6 +116,7 @@
113 location: Location { 116 location: Location {
114 uri: Url { 117 uri: Url {
115 scheme: "file", 118 scheme: "file",
119 cannot_be_a_base: false,
116 username: "", 120 username: "",
117 password: None, 121 password: None,
118 host: None, 122 host: None,
@@ -154,6 +158,7 @@
154 { 158 {
155 Url { 159 Url {
156 scheme: "file", 160 scheme: "file",
161 cannot_be_a_base: false,
157 username: "", 162 username: "",
158 password: None, 163 password: None,
159 host: None, 164 host: None,
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt
index f7a313cf1..5ea27a152 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt
@@ -2,6 +2,7 @@
2 MappedRustDiagnostic { 2 MappedRustDiagnostic {
3 url: Url { 3 url: Url {
4 scheme: "file", 4 scheme: "file",
5 cannot_be_a_base: false,
5 username: "", 6 username: "",
6 password: None, 7 password: None,
7 host: None, 8 host: None,
@@ -33,6 +34,7 @@
33 CodeDescription { 34 CodeDescription {
34 href: Url { 35 href: Url {
35 scheme: "https", 36 scheme: "https",
37 cannot_be_a_base: false,
36 username: "", 38 username: "",
37 password: None, 39 password: None,
38 host: Some( 40 host: Some(
@@ -59,6 +61,7 @@
59 location: Location { 61 location: Location {
60 uri: Url { 62 uri: Url {
61 scheme: "file", 63 scheme: "file",
64 cannot_be_a_base: false,
62 username: "", 65 username: "",
63 password: None, 66 password: None,
64 host: None, 67 host: None,
@@ -90,6 +93,7 @@
90 MappedRustDiagnostic { 93 MappedRustDiagnostic {
91 url: Url { 94 url: Url {
92 scheme: "file", 95 scheme: "file",
96 cannot_be_a_base: false,
93 username: "", 97 username: "",
94 password: None, 98 password: None,
95 host: None, 99 host: None,
@@ -121,6 +125,7 @@
121 CodeDescription { 125 CodeDescription {
122 href: Url { 126 href: Url {
123 scheme: "https", 127 scheme: "https",
128 cannot_be_a_base: false,
124 username: "", 129 username: "",
125 password: None, 130 password: None,
126 host: Some( 131 host: Some(
@@ -147,6 +152,7 @@
147 location: Location { 152 location: Location {
148 uri: Url { 153 uri: Url {
149 scheme: "file", 154 scheme: "file",
155 cannot_be_a_base: false,
150 username: "", 156 username: "",
151 password: None, 157 password: None,
152 host: None, 158 host: None,
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt b/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt
index 57d2f1ae3..43b1ea765 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt
@@ -2,6 +2,7 @@
2 MappedRustDiagnostic { 2 MappedRustDiagnostic {
3 url: Url { 3 url: Url {
4 scheme: "file", 4 scheme: "file",
5 cannot_be_a_base: false,
5 username: "", 6 username: "",
6 password: None, 7 password: None,
7 host: None, 8 host: None,
@@ -33,6 +34,7 @@
33 CodeDescription { 34 CodeDescription {
34 href: Url { 35 href: Url {
35 scheme: "https", 36 scheme: "https",
37 cannot_be_a_base: false,
36 username: "", 38 username: "",
37 password: None, 39 password: None,
38 host: Some( 40 host: Some(
@@ -59,6 +61,7 @@
59 location: Location { 61 location: Location {
60 uri: Url { 62 uri: Url {
61 scheme: "file", 63 scheme: "file",
64 cannot_be_a_base: false,
62 username: "", 65 username: "",
63 password: None, 66 password: None,
64 host: None, 67 host: None,
@@ -84,6 +87,7 @@
84 location: Location { 87 location: Location {
85 uri: Url { 88 uri: Url {
86 scheme: "file", 89 scheme: "file",
90 cannot_be_a_base: false,
87 username: "", 91 username: "",
88 password: None, 92 password: None,
89 host: None, 93 host: None,
@@ -115,6 +119,7 @@
115 MappedRustDiagnostic { 119 MappedRustDiagnostic {
116 url: Url { 120 url: Url {
117 scheme: "file", 121 scheme: "file",
122 cannot_be_a_base: false,
118 username: "", 123 username: "",
119 password: None, 124 password: None,
120 host: None, 125 host: None,
@@ -146,6 +151,7 @@
146 CodeDescription { 151 CodeDescription {
147 href: Url { 152 href: Url {
148 scheme: "https", 153 scheme: "https",
154 cannot_be_a_base: false,
149 username: "", 155 username: "",
150 password: None, 156 password: None,
151 host: Some( 157 host: Some(
@@ -172,6 +178,7 @@
172 location: Location { 178 location: Location {
173 uri: Url { 179 uri: Url {
174 scheme: "file", 180 scheme: "file",
181 cannot_be_a_base: false,
175 username: "", 182 username: "",
176 password: None, 183 password: None,
177 host: None, 184 host: None,
@@ -203,6 +210,7 @@
203 MappedRustDiagnostic { 210 MappedRustDiagnostic {
204 url: Url { 211 url: Url {
205 scheme: "file", 212 scheme: "file",
213 cannot_be_a_base: false,
206 username: "", 214 username: "",
207 password: None, 215 password: None,
208 host: None, 216 host: None,
@@ -234,6 +242,7 @@
234 CodeDescription { 242 CodeDescription {
235 href: Url { 243 href: Url {
236 scheme: "https", 244 scheme: "https",
245 cannot_be_a_base: false,
237 username: "", 246 username: "",
238 password: None, 247 password: None,
239 host: Some( 248 host: Some(
@@ -260,6 +269,7 @@
260 location: Location { 269 location: Location {
261 uri: Url { 270 uri: Url {
262 scheme: "file", 271 scheme: "file",
272 cannot_be_a_base: false,
263 username: "", 273 username: "",
264 password: None, 274 password: None,
265 host: None, 275 host: None,
@@ -301,6 +311,7 @@
301 { 311 {
302 Url { 312 Url {
303 scheme: "file", 313 scheme: "file",
314 cannot_be_a_base: false,
304 username: "", 315 username: "",
305 password: None, 316 password: None,
306 host: None, 317 host: None,
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 0a3a56773..410384ae5 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -604,7 +604,7 @@ pub(crate) fn url_from_abs_path(path: &Path) -> lsp_types::Url {
604 // Note: lowercasing the `path` itself doesn't help, the `Url::parse` 604 // Note: lowercasing the `path` itself doesn't help, the `Url::parse`
605 // machinery *also* canonicalizes the drive letter. So, just massage the 605 // machinery *also* canonicalizes the drive letter. So, just massage the
606 // string in place. 606 // string in place.
607 let mut url = url.into_string(); 607 let mut url: String = url.into();
608 url[driver_letter_range].make_ascii_lowercase(); 608 url[driver_letter_range].make_ascii_lowercase();
609 lsp_types::Url::parse(&url).unwrap() 609 lsp_types::Url::parse(&url).unwrap()
610} 610}
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
index 747f0b9eb..a6c294245 100644
--- a/crates/syntax/Cargo.toml
+++ b/crates/syntax/Cargo.toml
@@ -14,7 +14,7 @@ doctest = false
14cov-mark = { version = "1.1", features = ["thread-local"] } 14cov-mark = { version = "1.1", features = ["thread-local"] }
15itertools = "0.10.0" 15itertools = "0.10.0"
16rowan = "=0.13.0-pre.6" 16rowan = "=0.13.0-pre.6"
17rustc_lexer = { version = "716.0.0", package = "rustc-ap-rustc_lexer" } 17rustc_lexer = { version = "720.0.0", package = "rustc-ap-rustc_lexer" }
18rustc-hash = "1.1.0" 18rustc-hash = "1.1.0"
19arrayvec = "0.7" 19arrayvec = "0.7"
20once_cell = "1.3.1" 20once_cell = "1.3.1"