diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-27 20:33:47 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-27 20:33:47 +0000 |
commit | efb63a7666cc9532d97fa7e0da14b540ae8bd5df (patch) | |
tree | c4c1b80d8e2dfbb6533cfbdf0bb647ddbeff9419 /crates/ra_hir/src/krate.rs | |
parent | b26ab3603d8f73c8e57e9e90d44486a608bc9370 (diff) | |
parent | e0660506719476a0546e10bee816d7220be85440 (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.rs | 7 |
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 @@ | |||
1 | use ra_syntax::SmolStr; | ||
2 | pub use ra_db::CrateId; | 1 | pub use ra_db::CrateId; |
3 | 2 | ||
4 | use crate::{HirDatabase, Module, Cancelable}; | 3 | use 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)] |
15 | pub struct CrateDependency { | 14 | pub struct CrateDependency { |
16 | pub krate: Crate, | 15 | pub krate: Crate, |
17 | pub name: SmolStr, | 16 | pub name: Name, |
18 | } | 17 | } |
19 | 18 | ||
20 | impl Crate { | 19 | impl 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() |