From 83f6dd14f8b33f076b92fbccfb020248b535cd07 Mon Sep 17 00:00:00 2001 From: Shoyu Vanilla Date: Thu, 29 Feb 2024 00:52:30 +0900 Subject: [PATCH] Add a new failing test for Goto index_mut definition --- crates/ide/src/goto_definition.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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 @@ -1955,6 +1955,34 @@ fn f() { ); } + #[test] + fn goto_index_mut_op() { + check( + r#" +//- minicore: index + +struct Foo; +struct Bar; + +impl core::ops::Index for Foo { + type Output = Bar; + + fn index(&self, index: usize) -> &Self::Output {} +} + +impl core::ops::IndexMut 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(