diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-02 13:05:54 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-02 13:05:54 +0000 |
commit | afa972e78d2d81598c02b742ab84d70c88208300 (patch) | |
tree | 2ec32a586d0ee00e0d35a489efeaf31c91d14a15 /crates/ra_hir/src/krate.rs | |
parent | e4ffd7b31780b1f2ac6dcb731566b583bf562647 (diff) | |
parent | 1076e82856f353763de8426d378fcd1e371cbed4 (diff) |
Merge #403
403: initial support for macros r=matklad a=matklad
I'll write a more comprehensive description when this is closer to being done. Basically this investigates one question: "how do we represent code which is a result of a macro call". This is an interesting question: currently everything is `FileId` based, but macro expansion does not have a file!
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 | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_hir/src/krate.rs b/crates/ra_hir/src/krate.rs index 89b1e639e..a0821d15d 100644 --- a/crates/ra_hir/src/krate.rs +++ b/crates/ra_hir/src/krate.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | pub use ra_db::CrateId; | 1 | pub use ra_db::{CrateId, Cancelable}; |
2 | 2 | ||
3 | use crate::{HirDatabase, Module, Cancelable, Name, AsName}; | 3 | use crate::{HirDatabase, Module, Name, AsName, HirFileId}; |
4 | 4 | ||
5 | /// 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 |
6 | /// 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 |
@@ -35,6 +35,7 @@ impl Crate { | |||
35 | let crate_graph = db.crate_graph(); | 35 | let crate_graph = db.crate_graph(); |
36 | let file_id = crate_graph.crate_root(self.crate_id); | 36 | let file_id = crate_graph.crate_root(self.crate_id); |
37 | let source_root_id = db.file_source_root(file_id); | 37 | let source_root_id = db.file_source_root(file_id); |
38 | let file_id = HirFileId::from(file_id); | ||
38 | let module_tree = db.module_tree(source_root_id)?; | 39 | let module_tree = db.module_tree(source_root_id)?; |
39 | // FIXME: teach module tree about crate roots instead of guessing | 40 | // FIXME: teach module tree about crate roots instead of guessing |
40 | let (module_id, _) = ctry!(module_tree | 41 | let (module_id, _) = ctry!(module_tree |