aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-12-18 19:01:02 +0000
committerJonas Schievink <[email protected]>2020-12-18 19:01:02 +0000
commit382ee2fa037a3ec293d332dd70f04975396b5513 (patch)
treeea3ea6ec6423d27568c0afc90492c46d2a744abe /crates
parentd42d1d33f029ac09d4848c102b53ca39da6d0f4e (diff)
Add test
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_def/src/nameres/tests/diagnostics.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs
index 1a7b98831..4093f8bd0 100644
--- a/crates/hir_def/src/nameres/tests/diagnostics.rs
+++ b/crates/hir_def/src/nameres/tests/diagnostics.rs
@@ -119,3 +119,19 @@ fn inactive_item() {
119 "#, 119 "#,
120 ); 120 );
121} 121}
122
123/// Tests that `cfg` attributes behind `cfg_attr` is handled properly.
124#[test]
125fn inactive_via_cfg_attr() {
126 check_diagnostics(
127 r#"
128 //- /lib.rs
129 #[cfg_attr(not(never), cfg(no))] fn f() {}
130 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ code is inactive due to #[cfg] directives: no is disabled
131
132 #[cfg_attr(not(never), cfg(not(no)))] fn f() {}
133
134 #[cfg_attr(never, cfg(no))] fn g() {}
135 "#,
136 );
137}