diff options
Diffstat (limited to 'crates/hir_def/src/nameres/tests')
-rw-r--r-- | crates/hir_def/src/nameres/tests/diagnostics.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs index 576b813d2..5972248de 100644 --- a/crates/hir_def/src/nameres/tests/diagnostics.rs +++ b/crates/hir_def/src/nameres/tests/diagnostics.rs | |||
@@ -129,3 +129,25 @@ fn unresolved_module() { | |||
129 | ", | 129 | ", |
130 | ); | 130 | ); |
131 | } | 131 | } |
132 | |||
133 | #[test] | ||
134 | fn inactive_item() { | ||
135 | // Additional tests in `cfg` crate. This only tests disabled cfgs. | ||
136 | |||
137 | check_diagnostics( | ||
138 | r#" | ||
139 | //- /lib.rs | ||
140 | #[cfg(no)] pub fn f() {} | ||
141 | //^^^^^^^^^^^^^^^^^^^^^^^^ code is inactive due to #[cfg] directives: no is disabled | ||
142 | |||
143 | #[cfg(no)] #[cfg(no2)] mod m; | ||
144 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ code is inactive due to #[cfg] directives: no and no2 are disabled | ||
145 | |||
146 | #[cfg(all(not(a), b))] enum E {} | ||
147 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ code is inactive due to #[cfg] directives: b is disabled | ||
148 | |||
149 | #[cfg(feature = "std")] use std; | ||
150 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ code is inactive due to #[cfg] directives: feature = "std" is disabled | ||
151 | "#, | ||
152 | ); | ||
153 | } | ||