Skip to content

Commit 83f6dd1

Browse files
committed
Add a new failing test for Goto index_mut definition
1 parent 0ac05c0 commit 83f6dd1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

crates/ide/src/goto_definition.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,6 +1955,34 @@ fn f() {
19551955
);
19561956
}
19571957

1958+
#[test]
1959+
fn goto_index_mut_op() {
1960+
check(
1961+
r#"
1962+
//- minicore: index
1963+
1964+
struct Foo;
1965+
struct Bar;
1966+
1967+
impl core::ops::Index<usize> for Foo {
1968+
type Output = Bar;
1969+
1970+
fn index(&self, index: usize) -> &Self::Output {}
1971+
}
1972+
1973+
impl core::ops::IndexMut<usize> for Foo {
1974+
fn index_mut(&mut self, index: usize) -> &mut Self::Output {}
1975+
//^^^^^^^^^
1976+
}
1977+
1978+
fn f() {
1979+
let mut foo = Foo;
1980+
foo[0]$0 = Bar;
1981+
}
1982+
"#,
1983+
);
1984+
}
1985+
19581986
#[test]
19591987
fn goto_prefix_op() {
19601988
check(

0 commit comments

Comments
 (0)