aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/parent_module.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-10-05 15:25:59 +0100
committerGitHub <[email protected]>2019-10-05 15:25:59 +0100
commitae6305b90c80eb919cfde985cba66975b6222ed2 (patch)
treede601daf3714c4bda937e7cad05d048b69d16e71 /crates/ra_ide_api/src/parent_module.rs
parentdbf869b4d2dac09df17609edf6e67c1611b71dc5 (diff)
parentc6303d9fee98232ac83a77f943c39d65c9c6b6db (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_ide_api/src/parent_module.rs')
-rw-r--r--crates/ra_ide_api/src/parent_module.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/crates/ra_ide_api/src/parent_module.rs b/crates/ra_ide_api/src/parent_module.rs
index c85f1d0d0..566509849 100644
--- a/crates/ra_ide_api/src/parent_module.rs
+++ b/crates/ra_ide_api/src/parent_module.rs
@@ -41,6 +41,7 @@ mod tests {
41 AnalysisChange, CrateGraph, 41 AnalysisChange, CrateGraph,
42 Edition::Edition2018, 42 Edition::Edition2018,
43 }; 43 };
44 use ra_cfg::CfgOptions;
44 45
45 #[test] 46 #[test]
46 fn test_resolve_parent_module() { 47 fn test_resolve_parent_module() {
@@ -88,7 +89,7 @@ mod tests {
88 assert!(host.analysis().crate_for(mod_file).unwrap().is_empty()); 89 assert!(host.analysis().crate_for(mod_file).unwrap().is_empty());
89 90
90 let mut crate_graph = CrateGraph::default(); 91 let mut crate_graph = CrateGraph::default();
91 let crate_id = crate_graph.add_crate_root(root_file, Edition2018); 92 let crate_id = crate_graph.add_crate_root(root_file, Edition2018, CfgOptions::default());
92 let mut change = AnalysisChange::new(); 93 let mut change = AnalysisChange::new();
93 change.set_crate_graph(crate_graph); 94 change.set_crate_graph(crate_graph);
94 host.apply_change(change); 95 host.apply_change(change);