diff options
author | Aleksey Kladov <[email protected]> | 2018-12-08 22:02:53 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-12-09 10:33:16 +0000 |
commit | 961cae7e53a05625f3e010076673ca083479b481 (patch) | |
tree | 653672f36816ff6eb2bf098a06e48e7d3adbee56 /crates/ra_db | |
parent | ca7e5905c1daffbed6a08fe674ae821f99bd274d (diff) |
thread info about dep names
Diffstat (limited to 'crates/ra_db')
-rw-r--r-- | crates/ra_db/src/input.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index 37da8c549..44c5bac93 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use rustc_hash::FxHashMap; | 3 | use rustc_hash::{FxHashSet, FxHashMap}; |
4 | use rustc_hash::FxHashSet; | 4 | use ra_syntax::SmolStr; |
5 | use salsa; | 5 | use salsa; |
6 | 6 | ||
7 | use crate::file_resolver::FileResolverImp; | 7 | use crate::file_resolver::FileResolverImp; |
@@ -31,14 +31,15 @@ impl CrateData { | |||
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | fn add_dep(&mut self, dep: CrateId) { | 34 | fn add_dep(&mut self, name: SmolStr, crate_id: CrateId) { |
35 | self.dependencies.push(Dependency { crate_id: dep }) | 35 | self.dependencies.push(Dependency { name, crate_id }) |
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||
39 | #[derive(Debug, Clone, PartialEq, Eq)] | 39 | #[derive(Debug, Clone, PartialEq, Eq)] |
40 | pub struct Dependency { | 40 | pub struct Dependency { |
41 | crate_id: CrateId, | 41 | crate_id: CrateId, |
42 | name: SmolStr, | ||
42 | } | 43 | } |
43 | 44 | ||
44 | impl Dependency { | 45 | impl Dependency { |
@@ -57,8 +58,8 @@ impl CrateGraph { | |||
57 | //FIXME: check that we don't have cycles here. | 58 | //FIXME: check that we don't have cycles here. |
58 | // Just a simple depth first search from `to` should work, | 59 | // Just a simple depth first search from `to` should work, |
59 | // the graph is small. | 60 | // the graph is small. |
60 | pub fn add_dep(&mut self, from: CrateId, to: CrateId) { | 61 | pub fn add_dep(&mut self, from: CrateId, name: SmolStr, to: CrateId) { |
61 | self.arena.get_mut(&from).unwrap().add_dep(to) | 62 | self.arena.get_mut(&from).unwrap().add_dep(name, to) |
62 | } | 63 | } |
63 | pub fn crate_root(&self, crate_id: CrateId) -> FileId { | 64 | pub fn crate_root(&self, crate_id: CrateId) -> FileId { |
64 | self.arena[&crate_id].file_id | 65 | self.arena[&crate_id].file_id |