about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-05-18 11:26:54 +0000
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-05-18 11:46:08 +0000
commitf630419351122a3af49ca1ea65f88c69b6a8a004 (patch)
tree33b3de83b17a4c2a8d08785d37e953c6092c84ce /src/test
parent30422de32d905dca54e503ec7990c4d7d11334da (diff)
downloadrust-f630419351122a3af49ca1ea65f88c69b6a8a004.tar.gz
rust-f630419351122a3af49ca1ea65f88c69b6a8a004.zip
Fix bug in macro expression spans
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue-2.rs3
-rw-r--r--src/test/compile-fail/issue-15167.rs12
-rw-r--r--src/test/compile-fail/macro-backtrace-invalid-internals.rs10
-rw-r--r--src/test/compile-fail/macro-backtrace-nested.rs11
-rw-r--r--src/test/compile-fail/macro-backtrace-println.rs8
5 files changed, 23 insertions, 21 deletions
diff --git a/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue-2.rs b/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue-2.rs
index 309e286f48e..7b811f581c1 100644
--- a/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue-2.rs
+++ b/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue-2.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// error-pattern: borrowed value does not live long enough
+
 struct defer<'a> {
     x: &'a [&'a str],
 }
@@ -28,6 +30,5 @@ fn defer<'r>(x: &'r [&'r str]) -> defer<'r> {
 
 fn main() {
     let x = defer(&vec!("Goodbye", "world!"));
-    //~^ ERROR borrowed value does not live long enough
     x.x[0];
 }
diff --git a/src/test/compile-fail/issue-15167.rs b/src/test/compile-fail/issue-15167.rs
index 898e6be6fc8..2bd7da91d2c 100644
--- a/src/test/compile-fail/issue-15167.rs
+++ b/src/test/compile-fail/issue-15167.rs
@@ -11,22 +11,26 @@
 // macro f should not be able to inject a reference to 'n'.
 
 macro_rules! f { () => (n) }
+//~^ ERROR unresolved name `n`
+//~| ERROR unresolved name `n`
+//~| ERROR unresolved name `n`
+//~| ERROR unresolved name `n`
 
 fn main() -> (){
     for n in 0..1 {
-        println!("{}", f!()); //~ ERROR unresolved name `n`
+        println!("{}", f!());
     }
 
     if let Some(n) = None {
-        println!("{}", f!()); //~ ERROR unresolved name `n`
+        println!("{}", f!());
     }
 
     if false {
     } else if let Some(n) = None {
-        println!("{}", f!()); //~ ERROR unresolved name `n`
+        println!("{}", f!());
     }
 
     while let Some(n) = None {
-        println!("{}", f!()); //~ ERROR unresolved name `n`
+        println!("{}", f!());
     }
 }
diff --git a/src/test/compile-fail/macro-backtrace-invalid-internals.rs b/src/test/compile-fail/macro-backtrace-invalid-internals.rs
index 5069ec7d284..ebec204184d 100644
--- a/src/test/compile-fail/macro-backtrace-invalid-internals.rs
+++ b/src/test/compile-fail/macro-backtrace-invalid-internals.rs
@@ -36,13 +36,13 @@ macro_rules! fake_method_expr {
 
 macro_rules! fake_field_expr {
      () => {
-          1.fake
+          1.fake //~ ERROR no field with that name
      }
 }
 
 macro_rules! fake_anon_field_expr {
      () => {
-          (1).0
+          (1).0 //~ ERROR type was not a tuple
      }
 }
 
@@ -52,8 +52,6 @@ fn main() {
     fake_anon_field_stmt!(); //~ NOTE in this expansion of
 
     let _ = fake_method_expr!(); //~ NOTE in this expansion of
-    let _ = fake_field_expr!(); //~ ERROR no field with that name
-                                //~^ NOTE in this expansion of
-    let _ = fake_anon_field_expr!(); //~ ERROR type was not a tuple
-                                     //~^ NOTE in this expansion of
+    let _ = fake_field_expr!(); //~ NOTE in this expansion of
+    let _ = fake_anon_field_expr!(); //~ NOTE in this expansion of
 }
diff --git a/src/test/compile-fail/macro-backtrace-nested.rs b/src/test/compile-fail/macro-backtrace-nested.rs
index c935ccef055..c2a270ea9f5 100644
--- a/src/test/compile-fail/macro-backtrace-nested.rs
+++ b/src/test/compile-fail/macro-backtrace-nested.rs
@@ -12,20 +12,19 @@
 // we replace the span of the expanded expression with that of the call site.
 
 macro_rules! nested_expr {
-    () => (fake)
+    () => (fake) //~ ERROR unresolved name
+                 //~^ ERROR unresolved name
 }
 
 macro_rules! call_nested_expr {
-    () => (nested_expr!())
+    () => (nested_expr!()) //~ NOTE in this expansion of nested_expr!
 }
 
 macro_rules! call_nested_expr_sum {
-    () => { 1 + nested_expr!(); } //~ ERROR unresolved name
-                                  //~^ NOTE in this expansion of nested_expr!
+    () => { 1 + nested_expr!(); } //~ NOTE in this expansion of nested_expr!
 }
 
 fn main() {
-    1 + call_nested_expr!(); //~ ERROR unresolved name
-                             //~^ NOTE in this expansion of call_nested_expr!
+    1 + call_nested_expr!(); //~ NOTE in this expansion of call_nested_expr!
     call_nested_expr_sum!(); //~ NOTE in this expansion of
 }
diff --git a/src/test/compile-fail/macro-backtrace-println.rs b/src/test/compile-fail/macro-backtrace-println.rs
index a485b9056de..c2277c3e6d8 100644
--- a/src/test/compile-fail/macro-backtrace-println.rs
+++ b/src/test/compile-fail/macro-backtrace-println.rs
@@ -21,11 +21,11 @@ macro_rules! myprint {
 }
 
 macro_rules! myprintln {
-    ($fmt:expr) => (myprint!(concat!($fmt, "\n"))); //~ ERROR invalid reference to argument `0`
-                                                    //~^ NOTE in this expansion of myprint!
-                                                    //~^^ NOTE in this expansion of concat!
+    ($fmt:expr) => (myprint!(concat!($fmt, "\n"))); //~ NOTE in this expansion of myprint!
+                                                    //~^ NOTE in this expansion of concat!
 }
 
 fn main() {
-    myprintln!("{}"); //~ NOTE in this expansion of
+    myprintln!("{}"); //~ ERROR invalid reference to argument `0`
+                      //~^ NOTE in this expansion of
 }