Closed
Description
Steps to reproduce (rustc 1.25.0-nightly (56733bc9f 2018-02-01)
)
src/main.rs
#![feature(proc_macro)]
extern crate repro;
use repro::AsChangeset;
fn main() {
#[derive(AsChangeset)]
#[table_name = "users"]
struct UserForm {
id: i32,
name: String,
}
}
src/lib.rs
#![feature(proc_macro)]
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro_derive(AsChangeset, attributes(table_name))]
pub fn derive(input: TokenStream) -> TokenStream {
for tt in input {
println!("{:#?}", tt);
}
TokenStream::empty()
}
The struct
token will have an incorrect span which points at the correct source code, but shows <macro expansion>:1:1
instead of a file/line number when used. Every other token will have a useless span Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 }