aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/krate.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-27 20:33:47 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-27 20:33:47 +0000
commitefb63a7666cc9532d97fa7e0da14b540ae8bd5df (patch)
treec4c1b80d8e2dfbb6533cfbdf0bb647ddbeff9419 /crates/ra_hir/src/krate.rs
parentb26ab3603d8f73c8e57e9e90d44486a608bc9370 (diff)
parente0660506719476a0546e10bee816d7220be85440 (diff)
Merge #330
330: WIP: introduce hir::Name r=matklad a=matklad Currently we are using `SmolStr` throughout the hir as a name, but that is really suboptimal choice: we'll probably want some kind of interning in the future, and we'll definitely need to add hygene info to names. This PR aims to replace strings with a slightly more abstract `Name` type. Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/krate.rs')
-rw-r--r--crates/ra_hir/src/krate.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ra_hir/src/krate.rs b/crates/ra_hir/src/krate.rs
index 1196dcef1..89b1e639e 100644
--- a/crates/ra_hir/src/krate.rs
+++ b/crates/ra_hir/src/krate.rs
@@ -1,7 +1,6 @@
1use ra_syntax::SmolStr;
2pub use ra_db::CrateId; 1pub use ra_db::CrateId;
3 2
4use crate::{HirDatabase, Module, Cancelable}; 3use crate::{HirDatabase, Module, Cancelable, Name, AsName};
5 4
6/// hir::Crate describes a single crate. It's the main inteface with which 5/// hir::Crate describes a single crate. It's the main inteface with which
7/// crate's dependencies interact. Mostly, it should be just a proxy for the 6/// crate's dependencies interact. Mostly, it should be just a proxy for the
@@ -14,7 +13,7 @@ pub struct Crate {
14#[derive(Debug)] 13#[derive(Debug)]
15pub struct CrateDependency { 14pub struct CrateDependency {
16 pub krate: Crate, 15 pub krate: Crate,
17 pub name: SmolStr, 16 pub name: Name,
18} 17}
19 18
20impl Crate { 19impl Crate {
@@ -27,7 +26,7 @@ impl Crate {
27 .dependencies(self.crate_id) 26 .dependencies(self.crate_id)
28 .map(|dep| { 27 .map(|dep| {
29 let krate = Crate::new(dep.crate_id()); 28 let krate = Crate::new(dep.crate_id());
30 let name = dep.name.clone(); 29 let name = dep.as_name();
31 CrateDependency { krate, name } 30 CrateDependency { krate, name }
32 }) 31 })
33 .collect() 32 .collect()