about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-24 12:36:39 +0000
committerbors <bors@rust-lang.org>2023-12-24 12:36:39 +0000
commit85fb463fc586594925f05fc8e285b1568f98f41a (patch)
treebcc91a2fdbcfee1e1f6e562cffc14403207a00f0
parenta24ede2066778f66b5b5e5aa7aa57a6d1be2063a (diff)
parentcc73c00d81f7b9d97aa194cce3b0381540cf1582 (diff)
downloadrust-85fb463fc586594925f05fc8e285b1568f98f41a.tar.gz
rust-85fb463fc586594925f05fc8e285b1568f98f41a.zip
Auto merge of #16190 - Young-Flash:test_case_negative_impl, r=lnicola
add test case for negative impl

add a small test case to ensure that we don't emit `trait_impl_redundant_assoc_item` diagnostic for negative impl trait
-rw-r--r--crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs b/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs
index 82001439146..c202264bb56 100644
--- a/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs
+++ b/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs
@@ -76,4 +76,24 @@ impl Marker for Foo {
             "#,
         )
     }
+
+    #[test]
+    fn dont_work_for_negative_impl() {
+        check_diagnostics(
+            r#"
+trait Marker {
+    const FLAG: bool = false;
+    fn boo();
+    fn foo () {}
+}
+struct Foo;
+impl !Marker for Foo {
+    type T = i32;
+    const FLAG: bool = true;
+    fn bar() {}
+    fn boo() {}
+}
+            "#,
+        )
+    }
 }