diff options
author | Jonas Schievink <[email protected]> | 2020-10-22 18:19:18 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-10-22 18:19:18 +0100 |
commit | 3421b645e6f7d15ddad0e8e526d8a7db09b72516 (patch) | |
tree | e1ec7d37bd63ccc7f0e18b39479c0860b7fc5d9b /crates/hir_def/src/nameres/tests/diagnostics.rs | |
parent | 978cc936491d23bd38ef18aa98ddcc7472ef5f54 (diff) |
Emit better #[cfg] diagnostics
Diffstat (limited to 'crates/hir_def/src/nameres/tests/diagnostics.rs')
-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 | } | ||