Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/proc-macro-test/imp/src/lib.rs')
-rw-r--r--crates/proc-macro-test/imp/src/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/proc-macro-test/imp/src/lib.rs b/crates/proc-macro-test/imp/src/lib.rs
index 32510fba2f..d0f73dca32 100644
--- a/crates/proc-macro-test/imp/src/lib.rs
+++ b/crates/proc-macro-test/imp/src/lib.rs
@@ -1,6 +1,7 @@
//! Exports a few trivial procedural macros for testing.
#![warn(rust_2018_idioms, unused_lifetimes)]
+#![feature(proc_macro_span)]
use proc_macro::{Group, Ident, Literal, Punct, Span, TokenStream, TokenTree};
@@ -49,6 +50,17 @@ pub fn fn_like_mk_idents(_args: TokenStream) -> TokenStream {
TokenStream::from_iter(trees)
}
+#[proc_macro]
+pub fn fn_like_span_join(args: TokenStream) -> TokenStream {
+ let args = &mut args.into_iter();
+ let first = args.next().unwrap();
+ let second = args.next().unwrap();
+ TokenStream::from(TokenTree::from(Ident::new_raw(
+ "joined",
+ first.span().join(second.span()).unwrap(),
+ )))
+}
+
#[proc_macro_attribute]
pub fn attr_noop(_args: TokenStream, item: TokenStream) -> TokenStream {
item