about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2017-12-08 18:35:55 -0800
committerEsteban Küber <esteban@kuber.com.ar>2017-12-09 12:43:46 -0800
commitb7bb67abd32ae15476cd40746cae7f9a96bc65da (patch)
tree02bf83dec08fe27351b585b5c27ef1b9184e62b4 /src/test
parentc7b6d8263b0c106503d102ab8148769ac9f7d086 (diff)
downloadrust-b7bb67abd32ae15476cd40746cae7f9a96bc65da.tar.gz
rust-b7bb67abd32ae15476cd40746cae7f9a96bc65da.zip
Use spans for -Z external-macro-backtrace
```
% rustc ui/type-check/cannot_infer_local_or_vec.rs -Z external-macro-backtrace
error[E0282]: type annotations needed
  --> <vec macros>:3:1
   |
1  | / ( $ elem : expr ; $ n : expr ) => (
2  | | $ crate :: vec :: from_elem ( $ elem , $ n ) ) ; ( $ ( $ x : expr ) , * ) => (
3  | | < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ) ) ; ( $ ( $ x : expr , ) * )
   | | ^^^^^^^^^^^^^^^^^^^^^
   | | |
   | | cannot infer type for `T`
4  | | => ( vec ! [ $ ( $ x ) , * ] )
   | |______________________________- in this expansion of `vec!`
   |
  ::: ui/type-check/cannot_infer_local_or_vec.rs
   |
12 |       let x = vec![];
   |           -   ------ in this macro invocation
   |           |
   |           consider giving `x` a type

error: aborting due to previous error
```
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/macro_backtrace/auxiliary/ping.rs21
-rw-r--r--src/test/ui/macro_backtrace/main.rs5
-rw-r--r--src/test/ui/macro_backtrace/main.stderr86
3 files changed, 103 insertions, 9 deletions
diff --git a/src/test/ui/macro_backtrace/auxiliary/ping.rs b/src/test/ui/macro_backtrace/auxiliary/ping.rs
index eeed0d78158..e4131dde8f7 100644
--- a/src/test/ui/macro_backtrace/auxiliary/ping.rs
+++ b/src/test/ui/macro_backtrace/auxiliary/ping.rs
@@ -18,3 +18,24 @@ macro_rules! ping {
     }
 }
 
+#[macro_export]
+macro_rules! deep {
+    () => {
+        foo!();
+    }
+}
+
+#[macro_export]
+macro_rules! foo {
+    () => {
+        bar!();
+    }
+}
+
+#[macro_export]
+macro_rules! bar {
+    () => {
+        ping!();
+    }
+}
+
diff --git a/src/test/ui/macro_backtrace/main.rs b/src/test/ui/macro_backtrace/main.rs
index ec9218e3ec0..77faac17d1a 100644
--- a/src/test/ui/macro_backtrace/main.rs
+++ b/src/test/ui/macro_backtrace/main.rs
@@ -16,11 +16,14 @@
 
 // a local macro
 macro_rules! pong {
-    () => { syntax error }; //~ ERROR expected one of
+    () => { syntax error };
     //~^ ERROR expected one of
+    //~| ERROR expected one of
+    //~| ERROR expected one of
 }
 
 fn main() {
     pong!();
     ping!();
+    deep!();
 }
diff --git a/src/test/ui/macro_backtrace/main.stderr b/src/test/ui/macro_backtrace/main.stderr
index 4b10e5e19a3..e543a9f5bc0 100644
--- a/src/test/ui/macro_backtrace/main.stderr
+++ b/src/test/ui/macro_backtrace/main.stderr
@@ -1,17 +1,87 @@
 error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
   --> $DIR/main.rs:19:20
    |
-19 |     () => { syntax error }; //~ ERROR expected one of
-   |                    ^^^^^ expected one of 8 possible tokens here
-$DIR/main.rs:24:5: 24:13 note: in this expansion of pong! (defined in $DIR/main.rs)
+18 | / macro_rules! pong {
+19 | |     () => { syntax error };
+   | |                    ^^^^^ expected one of 8 possible tokens here
+20 | |     //~^ ERROR expected one of
+21 | |     //~| ERROR expected one of
+22 | |     //~| ERROR expected one of
+23 | | }
+   | |_- in this expansion of `pong!`
+...
+26 |       pong!();
+   |       -------- in this macro invocation
 
 error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
   --> $DIR/main.rs:19:20
    |
-19 |     () => { syntax error }; //~ ERROR expected one of
-   |                    ^^^^^ expected one of 8 possible tokens here
-$DIR/main.rs:25:5: 25:13 note: in this expansion of ping! (defined in <ping macros>)
-<ping macros>:1:11: 1:24 note: in this expansion of pong! (defined in $DIR/main.rs)
+18 | / macro_rules! pong {
+19 | |     () => { syntax error };
+   | |                    ^^^^^ expected one of 8 possible tokens here
+20 | |     //~^ ERROR expected one of
+21 | |     //~| ERROR expected one of
+22 | |     //~| ERROR expected one of
+23 | | }
+   | |_- in this expansion of `pong!`
+...
+27 |       ping!();
+   |       -------- in this macro invocation
+   | 
+  ::: <ping macros>
+   |
+1  |   (  ) => { pong ! (  ) ; }
+   |   -------------------------
+   |   |         |
+   |   |         in this macro invocation
+   |   in this expansion of `ping!`
+
+error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
+  --> $DIR/main.rs:19:20
+   |
+18 | / macro_rules! pong {
+19 | |     () => { syntax error };
+   | |                    ^^^^^ expected one of 8 possible tokens here
+20 | |     //~^ ERROR expected one of
+21 | |     //~| ERROR expected one of
+22 | |     //~| ERROR expected one of
+23 | | }
+   | |_- in this expansion of `pong!` (#5)
+...
+28 |       deep!();
+   |       -------- in this macro invocation (#1)
+   | 
+  ::: <deep macros>
+   |
+1  |   (  ) => { foo ! (  ) ; }
+   |   ------------------------
+   |   |         |
+   |   |         in this macro invocation (#2)
+   |   in this expansion of `deep!` (#1)
+   | 
+  ::: <foo macros>
+   |
+1  |   (  ) => { bar ! (  ) ; }
+   |   ------------------------
+   |   |         |
+   |   |         in this macro invocation (#3)
+   |   in this expansion of `foo!` (#2)
+   | 
+  ::: <bar macros>
+   |
+1  |   (  ) => { ping ! (  ) ; }
+   |   -------------------------
+   |   |         |
+   |   |         in this macro invocation (#4)
+   |   in this expansion of `bar!` (#3)
+   | 
+  ::: <ping macros>
+   |
+1  |   (  ) => { pong ! (  ) ; }
+   |   -------------------------
+   |   |         |
+   |   |         in this macro invocation (#5)
+   |   in this expansion of `ping!` (#4)
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors