mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-22 11:24:24 +00:00
Add a proc_macro_test crate
This exports all 3 kinds of proc macros and is useful for testing
This commit is contained in:
parent
c2594daf29
commit
cb816b1ea8
6 changed files with 51 additions and 3 deletions
18
crates/proc_macro_test/src/lib.rs
Normal file
18
crates/proc_macro_test/src/lib.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
//! Exports a few trivial procedural macros for testing.
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
#[proc_macro]
|
||||
pub fn function_like_macro(args: TokenStream) -> TokenStream {
|
||||
args
|
||||
}
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn attribute_macro(_args: TokenStream, item: TokenStream) -> TokenStream {
|
||||
item
|
||||
}
|
||||
|
||||
#[proc_macro_derive(DummyTrait)]
|
||||
pub fn derive_macro(_item: TokenStream) -> TokenStream {
|
||||
TokenStream::new()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue