about summary refs log tree commit diff
diff options
context:
space:
mode:
authorShoyu Vanilla <modulo641@gmail.com>2024-02-29 00:52:30 +0900
committerShoyu Vanilla <modulo641@gmail.com>2024-02-29 00:52:30 +0900
commit83f6dd14f8b33f076b92fbccfb020248b535cd07 (patch)
treef9449f45351cb55b5e63bee86842f9b78437335f
parent0ac05c05271f31c43d31017cbd288e8737a0edb0 (diff)
downloadrust-83f6dd14f8b33f076b92fbccfb020248b535cd07.tar.gz
rust-83f6dd14f8b33f076b92fbccfb020248b535cd07.zip
Add a new failing test for Goto index_mut definition
-rw-r--r--crates/ide/src/goto_definition.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs
index 35efe144e1b..41148db6146 100644
--- a/crates/ide/src/goto_definition.rs
+++ b/crates/ide/src/goto_definition.rs
@@ -1956,6 +1956,34 @@ fn f() {
     }
 
     #[test]
+    fn goto_index_mut_op() {
+        check(
+            r#"
+//- minicore: index
+
+struct Foo;
+struct Bar;
+
+impl core::ops::Index<usize> for Foo {
+    type Output = Bar;
+
+    fn index(&self, index: usize) -> &Self::Output {}
+}
+
+impl core::ops::IndexMut<usize> for Foo {
+    fn index_mut(&mut self, index: usize) -> &mut Self::Output {}
+     //^^^^^^^^^
+}
+
+fn f() {
+    let mut foo = Foo;
+    foo[0]$0 = Bar;
+}
+"#,
+        );
+    }
+
+    #[test]
     fn goto_prefix_op() {
         check(
             r#"