Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/inactive_code.rs')
| -rw-r--r-- | crates/ide-diagnostics/src/handlers/inactive_code.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/crates/ide-diagnostics/src/handlers/inactive_code.rs b/crates/ide-diagnostics/src/handlers/inactive_code.rs index 04918891b2..f558b7256a 100644 --- a/crates/ide-diagnostics/src/handlers/inactive_code.rs +++ b/crates/ide-diagnostics/src/handlers/inactive_code.rs @@ -140,4 +140,35 @@ trait Bar { "#, ); } + + #[test] + fn inactive_fields_and_variants() { + check( + r#" +enum Foo { + #[cfg(a)] Bar, +//^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: a is disabled + Baz { + #[cfg(a)] baz: String, + //^^^^^^^^^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: a is disabled + }, + Qux(#[cfg(a)] String), + //^^^^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: a is disabled +} + +struct Baz { + #[cfg(a)] baz: String, +//^^^^^^^^^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: a is disabled +} + +struct Qux(#[cfg(a)] String); + //^^^^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: a is disabled + +union FooBar { + #[cfg(a)] baz: u32, +//^^^^^^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: a is disabled +} +"#, + ); + } } |