Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/ide-diagnostics/src/handlers/no_such_field.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/ide-diagnostics/src/handlers/no_such_field.rs b/crates/ide-diagnostics/src/handlers/no_such_field.rs
index 5a20246cdd..8d77e566ed 100644
--- a/crates/ide-diagnostics/src/handlers/no_such_field.rs
+++ b/crates/ide-diagnostics/src/handlers/no_such_field.rs
@@ -129,6 +129,36 @@ mod tests {
use crate::tests::{check_diagnostics, check_fix, check_no_fix};
#[test]
+ fn dont_work_for_field_with_disabled_cfg() {
+ check_diagnostics(
+ r#"
+struct Test {
+ #[cfg(feature = "hello")]
+ test: u32,
+ other: u32
+}
+
+fn main() {
+ let a = Test {
+ #[cfg(feature = "hello")]
+ test: 1,
+ other: 1
+ };
+
+ let Test {
+ #[cfg(feature = "hello")]
+ test,
+ mut other,
+ ..
+ } = a;
+
+ other += 1;
+}
+"#,
+ );
+ }
+
+ #[test]
fn no_such_field_diagnostics() {
check_diagnostics(
r#"