aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock6
-rw-r--r--crates/ra_assists/Cargo.toml3
-rw-r--r--crates/ra_assists/src/assists/move_bounds.rs2
-rw-r--r--crates/ra_hir/src/lib.rs1
-rw-r--r--crates/ra_hir/src/ty.rs24
-rw-r--r--crates/ra_hir/src/ty/infer/unify.rs19
-rw-r--r--crates/ra_hir/src/ty/lower.rs38
-rw-r--r--crates/ra_hir/src/ty/traits.rs2
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs3
-rw-r--r--crates/ra_hir/src/util.rs12
-rw-r--r--crates/ra_ide_api/src/db.rs2
-rw-r--r--crates/ra_lsp_server/Cargo.toml2
-rw-r--r--crates/ra_mbe/Cargo.toml1
-rw-r--r--crates/ra_syntax/Cargo.toml1
-rw-r--r--crates/ra_tt/Cargo.toml4
15 files changed, 55 insertions, 65 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"
891name = "ra_assists" 891name = "ra_assists"
892version = "0.1.0" 892version = "0.1.0"
893dependencies = [ 893dependencies = [
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 = [
1053name = "ra_mbe" 1048name = "ra_mbe"
1054version = "0.1.0" 1049version = "0.1.0"
1055dependencies = [ 1050dependencies = [
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]
8format-buf = "1.0.0" 8format-buf = "1.0.0"
9once_cell = "1.0.1"
10join_to_string = "0.1.3" 9join_to_string = "0.1.3"
11itertools = "0.8.0" 10itertools = "0.8.0"
12arrayvec = "0.4.10"
13rustc-hash = "1.0.1"
14rustc_lexer = "0.1.0" 11rustc_lexer = "0.1.0"
15 12
16ra_syntax = { path = "../ra_syntax" } 13ra_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_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;
51mod generics; 51mod generics;
52mod resolve; 52mod resolve;
53pub mod diagnostics; 53pub mod diagnostics;
54mod util;
54 55
55mod code_model; 56mod code_model;
56 57
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;
17use std::{fmt, iter, mem}; 17use std::{fmt, iter, mem};
18 18
19use crate::{ 19use 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};
23use display::{HirDisplay, HirFormatter}; 23use 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};
9use crate::util::make_mut_slice;
9 10
10impl<'a, D: HirDatabase> InferenceContext<'a, D> { 11impl<'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
570pub(crate) fn trait_env( 565pub(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
611fn fn_sig_for_fn(db: &impl HirDatabase, def: Function) -> FnSig { 605fn 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/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
3use 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.
7pub(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/db.rs b/crates/ra_ide_api/src/db.rs
index b9321464b..bbf04bcf7 100644
--- a/crates/ra_ide_api/src/db.rs
+++ b/crates/ra_ide_api/src/db.rs
@@ -123,7 +123,7 @@ pub(crate) trait LineIndexDatabase: ra_db::SourceDatabase + CheckCanceled {
123 fn line_index(&self, file_id: FileId) -> Arc<LineIndex>; 123 fn line_index(&self, file_id: FileId) -> Arc<LineIndex>;
124} 124}
125 125
126fn line_index(db: &impl ra_db::SourceDatabase, file_id: FileId) -> Arc<LineIndex> { 126fn line_index(db: &impl LineIndexDatabase, file_id: FileId) -> Arc<LineIndex> {
127 let text = db.file_text(file_id); 127 let text = db.file_text(file_id);
128 Arc::new(LineIndex::new(&*text)) 128 Arc::new(LineIndex::new(&*text))
129} 129}
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"
18jod-thread = "0.1.0" 18jod-thread = "0.1.0"
19ra_vfs = "0.4.0" 19ra_vfs = "0.4.0"
20ra_syntax = { path = "../ra_syntax" } 20ra_syntax = { path = "../ra_syntax" }
21ra_db = { path = "../ra_db" }
22ra_cfg = { path = "../ra_cfg" }
23ra_text_edit = { path = "../ra_text_edit" } 21ra_text_edit = { path = "../ra_text_edit" }
24ra_ide_api = { path = "../ra_ide_api" } 22ra_ide_api = { path = "../ra_ide_api" }
25lsp-server = "0.2.0" 23lsp-server = "0.2.0"
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"]
8ra_syntax = { path = "../ra_syntax" } 8ra_syntax = { path = "../ra_syntax" }
9ra_parser = { path = "../ra_parser" } 9ra_parser = { path = "../ra_parser" }
10tt = { path = "../ra_tt", package = "ra_tt" } 10tt = { path = "../ra_tt", package = "ra_tt" }
11itertools = "0.8.0"
12rustc-hash = "1.0.0" 11rustc-hash = "1.0.0"
13smallvec = "0.6.9" 12smallvec = "0.6.9"
14log = "0.4.5" 13log = "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"
15arrayvec = "0.4.10" 15arrayvec = "0.4.10"
16once_cell = "1.2.0" 16once_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
20smol_str = { version = "0.1.12", features = ["serde"] } 21smol_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"
5authors = ["rust-analyzer developers"] 5authors = ["rust-analyzer developers"]
6 6
7[dependencies] 7[dependencies]
8smol_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
10smol_str = { version = "0.1.12", features = ["serde"] }