aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/tests
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-03-19 17:24:04 +0000
committerJonas Schievink <[email protected]>2021-03-19 17:24:04 +0000
commitcf494a515ff70675a4531585aa24a792f5b5e896 (patch)
tree2d69a62693790a12c98bfd414ecfcd6bbac1b1eb /crates/hir_def/src/nameres/tests
parentdc8e2fea98aecbba0c587e5999b9e09533e0091c (diff)
Fix handling of `#![cfg]` in outline module file
Diffstat (limited to 'crates/hir_def/src/nameres/tests')
-rw-r--r--crates/hir_def/src/nameres/tests/mod_resolution.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres/tests/mod_resolution.rs b/crates/hir_def/src/nameres/tests/mod_resolution.rs
index dfbbad1f9..16a2cd27a 100644
--- a/crates/hir_def/src/nameres/tests/mod_resolution.rs
+++ b/crates/hir_def/src/nameres/tests/mod_resolution.rs
@@ -819,3 +819,22 @@ pub mod hash { pub trait Hash {} }
819 "#]], 819 "#]],
820 ); 820 );
821} 821}
822
823#[test]
824fn cfg_in_module_file() {
825 // Inner `#![cfg]` in a module file makes the whole module disappear.
826 check(
827 r#"
828//- /main.rs
829mod module;
830
831//- /module.rs
832#![cfg(NEVER)]
833
834struct AlsoShoulntAppear;
835 "#,
836 expect![[r#"
837 crate
838 "#]],
839 )
840}