From e2c1da36f59cd99d4da4c1d5f8f323626d3dbe61 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sat, 10 Apr 2021 23:12:02 +0200 Subject: Support macros in pattern position --- crates/ide/src/goto_definition.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'crates/ide') diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index ca8ccb2da..d057d5402 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -1185,6 +1185,32 @@ pub mod theitem { pub fn gimme() -> theitem::TheItem { theitem::TheItem } +"#, + ); + } + + #[test] + fn goto_ident_from_pat_macro() { + check( + r#" +macro_rules! pat { + ($name:ident) => { Enum::Variant1($name) } +} + +enum Enum { + Variant1(u8), + Variant2, +} + +fn f(e: Enum) { + match e { + pat!(bind) => { + //^^^^ + bind$0 + } + Enum::Variant2 => {} + } +} "#, ); } -- cgit v1.2.3