aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-03-11 10:51:07 +0000
committerGitHub <[email protected]>2020-03-11 10:51:07 +0000
commitc48dcf74118b6e0df747f036a9b66701037f3fc7 (patch)
treebc047c31d43d2e16428c56bf7cdf305f4a30fa66 /crates/ra_hir_def
parent7b323b45a15809a20052f13d5a8f073aaa274a86 (diff)
parent6ea7c319154f9ec10721f4041afc9d07d6b2476b (diff)
Merge #3549
3549: Implement env! macro r=matklad a=edwin0cheng This PR implements `env!` macro by adding following things: 1. Added `additional_outdirs` settings in vscode. (naming to be bikeshed) 2. Added `ExternSourceId` which is a wrapping for SourceRootId but only used in extern sources. It is because `OUT_DIR` is not belonged to any crate and we have to access it behind an `AstDatabase`. 3. This PR does not implement the `OUT_DIR` parsing from `cargo check`. I don't have general design about this, @kiljacken could we reuse some cargo watch code for that ? ~~Block on [#3536]~~ PS: After this PR , we (kind of) completed the `include!(concat!(env!('OUT_DIR'), "foo.rs")` macro call combo. [Exodia Obliterate!](https://www.youtube.com/watch?v=RfqNH3FoGi0) Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/test_db.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/test_db.rs b/crates/ra_hir_def/src/test_db.rs
index 1568820e9..0756916a8 100644
--- a/crates/ra_hir_def/src/test_db.rs
+++ b/crates/ra_hir_def/src/test_db.rs
@@ -6,7 +6,7 @@ use std::{
6}; 6};
7 7
8use crate::db::DefDatabase; 8use crate::db::DefDatabase;
9use ra_db::{salsa, CrateId, FileId, FileLoader, FileLoaderDelegate, RelativePath}; 9use ra_db::{salsa, CrateId, ExternSourceId, FileId, FileLoader, FileLoaderDelegate, RelativePath};
10 10
11#[salsa::database( 11#[salsa::database(
12 ra_db::SourceDatabaseExtStorage, 12 ra_db::SourceDatabaseExtStorage,
@@ -52,6 +52,14 @@ impl FileLoader for TestDB {
52 fn relevant_crates(&self, file_id: FileId) -> Arc<Vec<CrateId>> { 52 fn relevant_crates(&self, file_id: FileId) -> Arc<Vec<CrateId>> {
53 FileLoaderDelegate(self).relevant_crates(file_id) 53 FileLoaderDelegate(self).relevant_crates(file_id)
54 } 54 }
55
56 fn resolve_extern_path(
57 &self,
58 extern_id: ExternSourceId,
59 relative_path: &RelativePath,
60 ) -> Option<FileId> {
61 FileLoaderDelegate(self).resolve_extern_path(extern_id, relative_path)
62 }
55} 63}
56 64
57impl TestDB { 65impl TestDB {