-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-decl-macros-1-2Area: Declarative macros 1.2Area: Declarative macros 1.2A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)Area: Declarative macros 2.0 (#39412)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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 }
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-decl-macros-1-2Area: Declarative macros 1.2Area: Declarative macros 1.2A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)Area: Declarative macros 2.0 (#39412)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.