Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/goto_implementation.rs')
| -rw-r--r-- | crates/ide/src/goto_implementation.rs | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/crates/ide/src/goto_implementation.rs b/crates/ide/src/goto_implementation.rs index 8a12cbaccc..76e5e9dd92 100644 --- a/crates/ide/src/goto_implementation.rs +++ b/crates/ide/src/goto_implementation.rs @@ -340,4 +340,75 @@ impl Tr for S { "#, ); } + + #[test] + fn goto_adt_implementation_inside_block() { + check( + r#" +//- minicore: copy, derive +trait Bar {} + +fn test() { + #[derive(Copy)] + //^^^^^^^^^^^^^^^ + struct Foo$0; + + impl Foo {} + //^^^ + + trait Baz {} + + impl Bar for Foo {} + //^^^ + + impl Baz for Foo {} + //^^^ +} +"#, + ); + } + + #[test] + fn goto_trait_implementation_inside_block() { + check( + r#" +struct Bar; + +fn test() { + trait Foo$0 {} + + struct Baz; + + impl Foo for Bar {} + //^^^ + + impl Foo for Baz {} + //^^^ +} +"#, + ); + check( + r#" +struct Bar; + +fn test() { + trait Foo { + fn foo$0() {} + } + + struct Baz; + + impl Foo for Bar { + fn foo() {} + //^^^ + } + + impl Foo for Baz { + fn foo() {} + //^^^ + } +} +"#, + ); + } } |