aboutsummaryrefslogtreecommitdiff
path: root/crates/proc_macro_test/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-08-14 23:29:04 +0100
committerGitHub <[email protected]>2020-08-14 23:29:04 +0100
commitf0ad68b96292bf6f8a1380b9af9cadc1c9b1a5f6 (patch)
tree4928418a4f8d49f030e0689131f4d48dd59dc555 /crates/proc_macro_test/src
parentc2594daf2974dbd4ce3d9b7ec72481764abaceb5 (diff)
parentcb816b1ea87b24f34eeecfdd98aeeb629915d661 (diff)
Merge #5762
5762: Add a proc_macro_test crate r=jonas-schievink a=jonas-schievink This exports all 3 kinds of proc macros and is useful for testing. bors r+ Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/proc_macro_test/src')
-rw-r--r--crates/proc_macro_test/src/lib.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/proc_macro_test/src/lib.rs b/crates/proc_macro_test/src/lib.rs
new file mode 100644
index 000000000..ec2a114a3
--- /dev/null
+++ b/crates/proc_macro_test/src/lib.rs
@@ -0,0 +1,18 @@
1//! Exports a few trivial procedural macros for testing.
2
3use proc_macro::TokenStream;
4
5#[proc_macro]
6pub fn function_like_macro(args: TokenStream) -> TokenStream {
7 args
8}
9
10#[proc_macro_attribute]
11pub fn attribute_macro(_args: TokenStream, item: TokenStream) -> TokenStream {
12 item
13}
14
15#[proc_macro_derive(DummyTrait)]
16pub fn derive_macro(_item: TokenStream) -> TokenStream {
17 TokenStream::new()
18}