aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/tests
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/nameres/tests')
-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}