1 // aux-build:parent-source-spans.rs
4 #![feature(decl_macro, proc_macro_hygiene)]
6 extern crate parent_source_spans;
8 use parent_source_spans::parent_source_spans;
10 macro one($a:expr, $b:expr) {
12 //~^ ERROR first parent: "hello"
13 //~| ERROR second parent: "world"
16 macro two($a:expr, $b:expr) {
18 //~^ ERROR first final: "hello"
19 //~| ERROR second final: "world"
20 //~| ERROR first final: "yay"
21 //~| ERROR second final: "rust"
24 // forwarding tokens directly doesn't create a new source chain
25 macro three($($tokens:tt)*) {
29 macro four($($tokens:tt)*) {
30 parent_source_spans!($($tokens)*);
34 one!("hello", "world");
35 //~^ ERROR first grandparent: "hello"
36 //~| ERROR second grandparent: "world"
37 //~| ERROR first source: "hello"
38 //~| ERROR second source: "world"
41 //~^ ERROR first parent: "yay"
42 //~| ERROR second parent: "rust"
43 //~| ERROR first source: "yay"
44 //~| ERROR second source: "rust"
47 //~^ ERROR first final: "hip"
48 //~| ERROR second final: "hop"
49 //~| ERROR first source: "hip"
50 //~| ERROR second source: "hop"