diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-24 15:59:47 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-24 15:59:47 +0000 |
commit | b0581c2403f49c68738c039065fa2cfc41345738 (patch) | |
tree | 2a977c54f7203f3f11784b7ee7ece20fd3b7ef9e /crates/ra_project_model/src/sysroot.rs | |
parent | 775bd98e5cf7918acf0dd72009ac14cf758ed0ca (diff) | |
parent | 6a8b4f873aa42f3522d3a92384019272b6ccefd2 (diff) |
Merge #2381
2381: Add proc-macro crate type handling r=JasperDeSutter a=JasperDeSutter
Resolves the libproc_macro crate in crates that are the proc-macro type.
This doesn't seem the ideal implementation though, since the compiler still requires you to write `extern crate proc_macro;` (even in 2018 edition).
Co-authored-by: JasperDeSutter <[email protected]>
Diffstat (limited to 'crates/ra_project_model/src/sysroot.rs')
-rw-r--r-- | crates/ra_project_model/src/sysroot.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/ra_project_model/src/sysroot.rs index bec9439d7..10ca391b6 100644 --- a/crates/ra_project_model/src/sysroot.rs +++ b/crates/ra_project_model/src/sysroot.rs | |||
@@ -39,6 +39,10 @@ impl Sysroot { | |||
39 | self.by_name("std") | 39 | self.by_name("std") |
40 | } | 40 | } |
41 | 41 | ||
42 | pub fn proc_macro(&self) -> Option<SysrootCrate> { | ||
43 | self.by_name("proc_macro") | ||
44 | } | ||
45 | |||
42 | pub fn crates<'a>(&'a self) -> impl Iterator<Item = SysrootCrate> + ExactSizeIterator + 'a { | 46 | pub fn crates<'a>(&'a self) -> impl Iterator<Item = SysrootCrate> + ExactSizeIterator + 'a { |
43 | self.crates.iter().map(|(id, _data)| id) | 47 | self.crates.iter().map(|(id, _data)| id) |
44 | } | 48 | } |
@@ -74,7 +78,7 @@ impl Sysroot { | |||
74 | } | 78 | } |
75 | } | 79 | } |
76 | if let Some(alloc) = sysroot.by_name("alloc") { | 80 | if let Some(alloc) = sysroot.by_name("alloc") { |
77 | if let Some(core) = sysroot.by_name("core") { | 81 | if let Some(core) = sysroot.core() { |
78 | sysroot.crates[alloc].deps.push(core); | 82 | sysroot.crates[alloc].deps.push(core); |
79 | } | 83 | } |
80 | } | 84 | } |