]> git.lizzy.rs Git - rust.git/commitdiff
Update tests with the new error messages
authorJakub Bukaj <jakub@jakub.cc>
Fri, 24 Oct 2014 19:17:50 +0000 (21:17 +0200)
committerJakub Bukaj <jakub@jakub.cc>
Tue, 28 Oct 2014 16:54:16 +0000 (17:54 +0100)
21 files changed:
src/test/compile-fail/bad-bang-ann-3.rs
src/test/compile-fail/bad-bang-ann.rs
src/test/compile-fail/bang-tailexpr.rs
src/test/compile-fail/binop-fail-3.rs [new file with mode: 0644]
src/test/compile-fail/closure-that-fails.rs
src/test/compile-fail/index-bot.rs
src/test/compile-fail/issue-13847.rs
src/test/compile-fail/issue-15207.rs
src/test/compile-fail/issue-15965.rs
src/test/compile-fail/issue-17373.rs
src/test/compile-fail/issue-5100.rs
src/test/compile-fail/issue-5500.rs [new file with mode: 0644]
src/test/compile-fail/issue-897-2.rs
src/test/compile-fail/issue-897.rs
src/test/compile-fail/liveness-bad-bang-2.rs
src/test/compile-fail/loop-does-not-diverge.rs
src/test/compile-fail/lub-match.rs
src/test/run-fail/binop-fail-3.rs [deleted file]
src/test/run-fail/issue-5500.rs [deleted file]
src/test/run-pass/issue-13352.rs
src/test/run-pass/unreachable-code.rs

index 943169be00452630ad0ec8ca8ea66378e180de7e..d204c8c750aae28797abd76cd3e1804076910690 100644 (file)
@@ -11,8 +11,7 @@
 // Tests that a function with a ! annotation always actually fails
 
 fn bad_bang(i: uint) -> ! {
-    return 7u;
-    //~^ ERROR expected `!`, found `uint`
+    return 7u; //~ ERROR `return` in a function declared as diverging [E0166]
 }
 
 fn main() { bad_bang(5u); }
index 18b98eb3a3881dacb81f740a4906652758abf790..69200ffedf9bb78d930dd8ae703b0484786947a9 100644 (file)
@@ -10,9 +10,8 @@
 
 // Tests that a function with a ! annotation always actually fails
 
-fn bad_bang(i: uint) -> ! {
+fn bad_bang(i: uint) -> ! { //~ ERROR computation may converge in a function marked as diverging
     if i < 0u { } else { fail!(); }
-    //~^ ERROR expected `!`, found `()`
 }
 
 fn main() { bad_bang(5u); }
index ff95f05279eea003c4c7d1abb1a6f826c00f562c..ec576ff4bd8c25f3964ae32a3be836387fba3469 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn f() -> ! {
-    3i //~ ERROR expected `!`, found `int`
+fn f() -> ! { //~ ERROR computation may converge in a function marked as diverging
+    3i
 }
 fn main() { }
diff --git a/src/test/compile-fail/binop-fail-3.rs b/src/test/compile-fail/binop-fail-3.rs
new file mode 100644 (file)
index 0000000..2d6f8cc
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo() -> ! { fail!("quux"); }
+fn main() {
+    foo() //~ ERROR the type of this value must be known in this context
+    ==
+    foo();
+}
index 7ce8e95a761f2bddfcca5d1ad5dd3863f9fbc032..05317e9c6b029970ccd59d05e5b4ef2a5a80b0cc 100644 (file)
@@ -14,7 +14,7 @@ fn main() {
     // Type inference didn't use to be able to handle this:
     foo(|| fail!());
     foo(|| -> ! fail!());
-    foo(|| 22); //~ ERROR mismatched types
-    foo(|| -> ! 22); //~ ERROR mismatched types
-    let x = || -> ! 1; //~ ERROR mismatched types
+    foo(|| 22i); //~ ERROR computation may converge in a function marked as diverging
+    foo(|| -> ! 22i); //~ ERROR computation may converge in a function marked as diverging
+    let x = || -> ! 1i; //~ ERROR computation may converge in a function marked as diverging
 }
index cf05cf51640e9246b616a34b83bb43df7b46faca..bd01d45fd44ecfd3af74c46da7e134114759e41d 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 fn main() {
-    (return)[0u]; //~ ERROR cannot index a value of type `!`
+    (return)[0u]; //~ ERROR the type of this value must be known in this context
 }
index c2972d4c5a8e0657463b9e318ed07710c82fccff..aa823d9a70e7c3f5b631f8743345a98fc8b5c856 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 fn main() {
-    return.is_failure //~ ERROR unconstrained type variable
+    return.is_failure //~ ERROR the type of this value must be known in this context
 }
index f1c0b622ae4373391e1c73df7d4f4a2fbbd2272b..37fcabef0ed9b0b4195dfbaa982beb56469f834c 100644 (file)
@@ -9,5 +9,9 @@
 // except according to those terms.
 
 fn main() {
-    loop { break.push(1); } //~ ERROR type `!` does not implement any method in scope named `push`
+    loop {
+        break.push(1) //~ ERROR the type of this value must be known in this context
+        //~^ ERROR multiple applicable methods in scope
+        ;
+    }
 }
index 410b1f94293a9e0ab571bcef2c319cf64e281ecc..856cd1b0f3f26c3397da7a98ced7b8a668c7cf3a 100644 (file)
@@ -9,5 +9,10 @@
 // except according to those terms.
 
 fn main() {
-    return { return () } (); //~ ERROR expected function, found `!`
+    return
+        { return () } //~ ERROR the type of this value must be known in this context
+    () //~^ ERROR the type of this value must be known in this context
+//~^^ ERROR notation; the first type parameter for the function trait is neither a tuple nor unit
+//~^^^ ERROR overloaded calls are experimental
+    ;
 }
index 9cfae2662ac00da602c7dd6a6c83bbbb9c2fb781..6895893adc4d0d503ccb14bf4a1af6ee17898b6b 100644 (file)
@@ -9,5 +9,6 @@
 // except according to those terms.
 
 fn main() {
-    *return; //~ ERROR type `!` cannot be dereferenced
+    *return //~ ERROR the type of this value must be known in this context
+    ;
 }
index 6524056df888b86b4a36fa92a649e963d3d283f2..3ddb713528c5511f8a158bda4cc8a18f1875ed94 100644 (file)
@@ -27,13 +27,13 @@ fn main() {
 
     match (true, false) {
         box (true, false) => ()
-        //~^ ERROR mismatched types: expected `(bool,bool)`, found `Box<<generic #11>>`
+        //~^ ERROR mismatched types: expected `(bool,bool)`, found `Box<<generic #15>>`
         //         (expected tuple, found box)
     }
 
     match (true, false) {
         &(true, false) => ()
-        //~^ ERROR mismatched types: expected `(bool,bool)`, found `&<generic #15>`
+        //~^ ERROR mismatched types: expected `(bool,bool)`, found `&<generic #21>`
         //         (expected tuple, found &-ptr)
     }
 
diff --git a/src/test/compile-fail/issue-5500.rs b/src/test/compile-fail/issue-5500.rs
new file mode 100644 (file)
index 0000000..e972379
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    &fail!()
+    //~^ ERROR mismatched types: expected `()`, found `&<generic #2>` (expected (), found &-ptr)
+}
index 45b45dbaf5da4edf25cdc495ff0fccca20e714e0..e6b97b727a7e9f078be1114ea736a06c8aa61385 100644 (file)
 
 fn g() -> ! { fail!(); }
 fn f() -> ! {
-    return g();
-    g(); //~ ERROR: unreachable statement
+    return g(); //~ ERROR `return` in a function declared as diverging
+    g();
+}
+fn h() -> ! {
+    loop {}
+    g();
 }
 
 fn main() { f() }
index f3429b97cfcb97b213398242909f9daabcce8dc0..944546d0b4a61e53fdd8debef92f3f0c634b6638 100644 (file)
@@ -8,12 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern: unreachable statement
-
 #![deny(unreachable_code)]
 
 fn f() -> ! {
-    return fail!();
+    return fail!(); //~ ERROR `return` in a function declared as diverging
     fail!(); // the unreachable statement error is in <std macro>, at this line, there
              // only is a note
 }
index f5ad5e6af0c8a81c10a35a197d97e64ace9bf571..04364e4e01088341af757036c32137862eca738a 100644 (file)
@@ -9,8 +9,9 @@
 // except according to those terms.
 
 // Tests that a function with a ! annotation always actually fails
-// error-pattern: some control paths may return
 
-fn bad_bang(i: uint) -> ! { println!("{}", 3i); }
+fn bad_bang(i: uint) -> ! { //~ ERROR computation may converge in a function marked as diverging
+    println!("{}", 3i);
+}
 
 fn main() { bad_bang(5u); }
index d0e5249305493523ad48208d5ffbf2ddc5d58a4f..9488e6bf969f023449c784ce977c34bea2bc9aab 100644 (file)
@@ -14,7 +14,7 @@ fn forever() -> ! {
   loop {
     break;
   }
-  return 42i; //~ ERROR expected `!`, found `int`
+  return 42i; //~ ERROR `return` in a function declared as diverging
 }
 
 fn main() {
index febe5f45d96b07bcee63a2c52f5b193e245d0f9e..df39e9e894eae8dcf9f4a7aede27c096919473c9 100644 (file)
@@ -33,7 +33,8 @@ pub fn opt_str1<'a>(maybestr: &'a Option<String>) -> &'a str {
 }
 
 pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
-    match *maybestr {  //~ ERROR cannot infer an appropriate lifetime for automatic coercion due to
+    match *maybestr {
+    //~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements
         None => "(none)",
         Some(ref s) => {
             let s: &'a str = s.as_slice();
@@ -43,7 +44,8 @@ pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
 }
 
 pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
-    match *maybestr {  //~ ERROR cannot infer an appropriate lifetime for automatic coercion due to
+    match *maybestr {
+    //~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements
         Some(ref s) => {
             let s: &'a str = s.as_slice();
             s
diff --git a/src/test/run-fail/binop-fail-3.rs b/src/test/run-fail/binop-fail-3.rs
deleted file mode 100644 (file)
index 150544f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern:quux
-fn foo() -> ! { fail!("quux"); }
-fn main() { foo() == foo(); }
diff --git a/src/test/run-fail/issue-5500.rs b/src/test/run-fail/issue-5500.rs
deleted file mode 100644 (file)
index 45dbe11..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern:explicit failure
-
-fn main() {
-    &fail!()
-}
index f0477817281a163a95db07bacefa90b7d46fce13..afebcb3cdfc7dae4a97b31ff6a34a0c97fd9d01d 100644 (file)
@@ -17,5 +17,4 @@ fn main() {
         unsafe { libc::exit(0 as libc::c_int); }
     });
     2u + (loop {});
-    -(loop {});
 }
index 6b6754f34326d67b618bcc65136ba89a8c778cf6..496be7e0e6abbec08ffa375b62bd10f9b87c0099 100644 (file)
@@ -23,8 +23,6 @@ fn call_id() {
 
 fn call_id_3() { id(return) && id(return); }
 
-fn ret_ret() -> int { return (return 2i) + 3i; }
-
 fn ret_guard() {
     match 2i {
       x if (return) => { x; }