Guess I should put this under version control LOL
This commit is contained in:
commit
2035318460
73 changed files with 8836 additions and 0 deletions
13
macros/src/span.rs
Normal file
13
macros/src/span.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//! Utility functions, originally written by Bodil Stokke
|
||||
//! over in [typed-html](https://github.com/bodil/typed-html).
|
||||
|
||||
use proc_macro;
|
||||
use proc_macro2;
|
||||
|
||||
pub fn from_unstable(span: proc_macro::Span) -> proc_macro2::Span {
|
||||
let ident = proc_macro::Ident::new("_", span);
|
||||
let tt = proc_macro::TokenTree::Ident(ident);
|
||||
let tts = proc_macro::TokenStream::from(tt);
|
||||
let tts2 = proc_macro2::TokenStream::from(tts);
|
||||
tts2.into_iter().next().unwrap().span()
|
||||
}
|
||||
Reference in a new issue