From d1bdebf2b969eee013de2c8f3a2512f799e00263 Mon Sep 17 00:00:00 2001 From: Shoyu Vanilla Date: Tue, 27 Feb 2024 23:53:43 +0900 Subject: [PATCH] Add a new failing test for goto deref_mut --- crates/ide/src/goto_definition.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 88255d222ed8..35efe144e1b9 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -1977,6 +1977,33 @@ fn f() { ); } + #[test] + fn goto_deref_mut() { + check( + r#" +//- minicore: deref, deref_mut + +struct Foo; +struct Bar; + +impl core::ops::Deref for Foo { + type Target = Bar; + fn deref(&self) -> &Self::Target {} +} + +impl core::ops::DerefMut for Foo { + fn deref_mut(&mut self) -> &mut Self::Target {} + //^^^^^^^^^ +} + +fn f() { + let a = Foo; + $0*a = Bar; +} +"#, + ); + } + #[test] fn goto_bin_op() { check(