From ef48d1ca3bfb512c245d9e9bdc73d0d5a5f79740 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sun, 14 Mar 2021 01:07:05 +0800 Subject: Add test for hover of macro expanded function --- crates/ide/src/hover.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index ea45086ce..f872b68cf 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -3657,4 +3657,42 @@ cosnt _: &str$0 = ""; }"#; "#]], ); } + + #[test] + fn hover_macro_expanded_function() { + check( + r#" +struct S<'a, T>(&'a T); +trait Clone {} +macro_rules! foo { + () => { + fn bar<'t, T: Clone + 't>(s: &mut S<'t, T>, t: u32) -> *mut u32 where + 't: 't + 't, + for<'a> T: Clone + 'a + { 0 as _ } + }; +} + +foo!(); + +fn main() { + bar$0; +} +"#, + expect![[r#" + *bar* + + ```rust + test + ``` + + ```rust + fn bar<'t, T: Clone + 't>(s: &mut S<'t, T>, t: u32) -> *mut u32 + where + 't: 't + 't, + for<'a> T: Clone + 'a, + ``` + "#]], + ) + } } -- cgit v1.2.3