1 // aux-build:parent-source-spans.rs
3 #![feature(decl_macro)]
5 extern crate parent_source_spans;
7 use parent_source_spans::parent_source_spans;
9 macro one($a:expr, $b:expr) {
11 //~^ ERROR first parent: "hello"
12 //~| ERROR second parent: "world"
15 macro two($a:expr, $b:expr) {
17 //~^ ERROR first final: "hello"
18 //~| ERROR second final: "world"
19 //~| ERROR first final: "yay"
20 //~| ERROR second final: "rust"
23 // forwarding tokens directly doesn't create a new source chain
24 macro three($($tokens:tt)*) {
28 macro four($($tokens:tt)*) {
29 parent_source_spans!($($tokens)*);
30 //~^ ERROR cannot find value `ok` in this scope
31 //~| ERROR cannot find value `ok` in this scope
32 //~| ERROR cannot find value `ok` in this scope
36 one!("hello", "world");
37 //~^ ERROR first grandparent: "hello"
38 //~| ERROR second grandparent: "world"
39 //~| ERROR first source: "hello"
40 //~| ERROR second source: "world"
43 //~^ ERROR first parent: "yay"
44 //~| ERROR second parent: "rust"
45 //~| ERROR first source: "yay"
46 //~| ERROR second source: "rust"
49 //~^ ERROR first final: "hip"
50 //~| ERROR second final: "hop"
51 //~| ERROR first source: "hip"
52 //~| ERROR second source: "hop"