From 1f1185dcbb3183db8a27d4b5884afaa3d1504027 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 9 Mar 2022 22:18:09 +0100 Subject: [PATCH] Specific proc-macro crate type for other test fixture where needed --- crates/ide/src/goto_definition.rs | 1 + crates/ide/src/references.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index d664e2ca653..3d22ed9c167 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -1244,6 +1244,7 @@ use mac::fn_macro; fn_macro$0!(); //- /mac.rs crate:mac +#![crate_type="proc-macro"] #[proc_macro] fn fn_macro() {} //^^^^^^^^ diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index c3ac84e58c6..73f736dffe4 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -1501,16 +1501,15 @@ fn f() { check( r#" //- proc_macros: identity - #[proc_macros::identity] fn func$0() { func(); } "#, expect![[r#" - func Function FileId(0) 26..51 29..33 + func Function FileId(0) 25..50 28..32 - FileId(0) 42..46 + FileId(0) 41..45 "#]], ) } @@ -1555,11 +1554,12 @@ fn func() {} ); check( r#" +#![crate_type="proc-macro"] #[proc_macro_attribute] fn func$0() {} "#, expect![[r#" - func Attribute FileId(0) 0..36 27..31 + func Attribute FileId(0) 28..64 55..59 (no references) "#]], @@ -1604,11 +1604,12 @@ struct Foo; ); check( r#" +#![crate_type="proc-macro"] #[proc_macro_derive(Derive, attributes(x))] pub fn deri$0ve(_stream: TokenStream) -> TokenStream {} "#, expect![[r#" - derive Derive FileId(0) 0..97 51..57 + derive Derive FileId(0) 28..125 79..85 (no references) "#]],