diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-05 15:25:59 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-05 15:25:59 +0100 |
commit | ae6305b90c80eb919cfde985cba66975b6222ed2 (patch) | |
tree | de601daf3714c4bda937e7cad05d048b69d16e71 /crates/ra_project_model/src/json_project.rs | |
parent | dbf869b4d2dac09df17609edf6e67c1611b71dc5 (diff) | |
parent | c6303d9fee98232ac83a77f943c39d65c9c6b6db (diff) |
Merge #1928
1928: Support `#[cfg(..)]` r=matklad a=oxalica
This PR implement `#[cfg(..)]` conditional compilation. It read default cfg options from `rustc --print cfg` with also hard-coded `test` and `debug_assertion` enabled.
Front-end settings are **not** included in this PR.
There is also a known issue that inner control attributes are totally ignored. I think it is **not** a part of `cfg` and create a separated issue for it. #1949
Fixes #1920
Related: #1073
Co-authored-by: uHOOCCOOHu <[email protected]>
Co-authored-by: oxalica <[email protected]>
Diffstat (limited to 'crates/ra_project_model/src/json_project.rs')
-rw-r--r-- | crates/ra_project_model/src/json_project.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_project_model/src/json_project.rs b/crates/ra_project_model/src/json_project.rs index 54ddca2cb..1bacb1d09 100644 --- a/crates/ra_project_model/src/json_project.rs +++ b/crates/ra_project_model/src/json_project.rs | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | use std::path::PathBuf; | 3 | use std::path::PathBuf; |
4 | 4 | ||
5 | use rustc_hash::{FxHashMap, FxHashSet}; | ||
5 | use serde::Deserialize; | 6 | use serde::Deserialize; |
6 | 7 | ||
7 | /// A root points to the directory which contains Rust crates. rust-analyzer watches all files in | 8 | /// A root points to the directory which contains Rust crates. rust-analyzer watches all files in |
@@ -19,6 +20,8 @@ pub struct Crate { | |||
19 | pub(crate) root_module: PathBuf, | 20 | pub(crate) root_module: PathBuf, |
20 | pub(crate) edition: Edition, | 21 | pub(crate) edition: Edition, |
21 | pub(crate) deps: Vec<Dep>, | 22 | pub(crate) deps: Vec<Dep>, |
23 | pub(crate) atom_cfgs: FxHashSet<String>, | ||
24 | pub(crate) key_value_cfgs: FxHashMap<String, String>, | ||
22 | } | 25 | } |
23 | 26 | ||
24 | #[derive(Clone, Copy, Debug, Deserialize)] | 27 | #[derive(Clone, Copy, Debug, Deserialize)] |