]> git.proxmox.com Git - rustc.git/blob - src/test/incremental/issue-85197-invalid-span/auxiliary/respan.rs
New upstream version 1.53.0+dfsg1
[rustc.git] / src / test / incremental / issue-85197-invalid-span / auxiliary / respan.rs
1 // force-host
2 // no-prefer-dynamic
3
4 #![crate_type = "proc-macro"]
5
6 extern crate proc_macro;
7 use proc_macro::TokenStream;
8
9
10 /// Copies the resolution information (the `SyntaxContext`) of the first
11 /// token to all other tokens in the stream. Does not recurse into groups.
12 #[proc_macro]
13 pub fn respan(input: TokenStream) -> TokenStream {
14 let first_span = input.clone().into_iter().next().unwrap().span();
15 input.into_iter().map(|mut tree| {
16 tree.set_span(tree.span().resolved_at(first_span));
17 tree
18 }).collect()
19 }