Skip to content

Commit 7f523e7

Browse files
author
Jakub Bukaj
committed
Update tests with the new error messages
1 parent cca84e9 commit 7f523e7

19 files changed

+45
-33
lines changed

src/test/compile-fail/bad-bang-ann-3.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
// Tests that a function with a ! annotation always actually fails
1212

1313
fn bad_bang(i: uint) -> ! {
14-
return 7u;
15-
//~^ ERROR expected `!`, found `uint`
14+
return 7u; //~ ERROR `return` in a function declared as diverging [E0166]
1615
}
1716

1817
fn main() { bad_bang(5u); }

src/test/compile-fail/bad-bang-ann.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010

1111
// Tests that a function with a ! annotation always actually fails
1212

13-
fn bad_bang(i: uint) -> ! {
13+
fn bad_bang(i: uint) -> ! { //~ ERROR computation may converge in a function marked as diverging
1414
if i < 0u { } else { fail!(); }
15-
//~^ ERROR expected `!`, found `()`
1615
}
1716

1817
fn main() { bad_bang(5u); }

src/test/compile-fail/bang-tailexpr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn f() -> ! {
12-
3i //~ ERROR expected `!`, found `int`
11+
fn f() -> ! { //~ ERROR computation may converge in a function marked as diverging
12+
3i
1313
}
1414
fn main() { }

src/test/run-fail/binop-fail-3.rs renamed to src/test/compile-fail/binop-fail-3.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:quux
1211
fn foo() -> ! { fail!("quux"); }
13-
fn main() { foo() == foo(); }
12+
fn main() {
13+
foo() //~ ERROR the type of this value must be known in this context
14+
==
15+
foo();
16+
}

src/test/compile-fail/closure-that-fails.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
// Type inference didn't use to be able to handle this:
1515
foo(|| fail!());
1616
foo(|| -> ! fail!());
17-
foo(|| 22); //~ ERROR mismatched types
18-
foo(|| -> ! 22); //~ ERROR mismatched types
19-
let x = || -> ! 1; //~ ERROR mismatched types
17+
foo(|| 22i); //~ ERROR computation may converge in a function marked as diverging
18+
foo(|| -> ! 22i); //~ ERROR computation may converge in a function marked as diverging
19+
let x = || -> ! 1i; //~ ERROR computation may converge in a function marked as diverging
2020
}

src/test/compile-fail/index-bot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
(return)[0u]; //~ ERROR cannot index a value of type `!`
12+
(return)[0u]; //~ ERROR the type of this value must be known in this context
1313
}

src/test/compile-fail/issue-13847.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
return.is_failure //~ ERROR unconstrained type variable
12+
return.is_failure //~ ERROR the type of this value must be known in this context
1313
}

src/test/compile-fail/issue-15207.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
loop { break.push(1); } //~ ERROR type `!` does not implement any method in scope named `push`
12+
loop {
13+
break.push(1) //~ ERROR the type of this value must be known in this context
14+
//~^ ERROR multiple applicable methods in scope
15+
;
16+
}
1317
}

src/test/compile-fail/issue-15965.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,10 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
return { return () } (); //~ ERROR expected function, found `!`
12+
return
13+
{ return () } //~ ERROR the type of this value must be known in this context
14+
() //~^ ERROR the type of this value must be known in this context
15+
//~^^ ERROR notation; the first type parameter for the function trait is neither a tuple nor unit
16+
//~^^^ ERROR overloaded calls are experimental
17+
;
1318
}

src/test/compile-fail/issue-17373.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
*return; //~ ERROR type `!` cannot be dereferenced
12+
*return //~ ERROR the type of this value must be known in this context
13+
;
1314
}

src/test/compile-fail/issue-5100.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ fn main() {
2727

2828
match (true, false) {
2929
box (true, false) => ()
30-
//~^ ERROR mismatched types: expected `(bool,bool)`, found `Box<<generic #11>>`
30+
//~^ ERROR mismatched types: expected `(bool,bool)`, found `Box<<generic #15>>`
3131
// (expected tuple, found box)
3232
}
3333

3434
match (true, false) {
3535
&(true, false) => ()
36-
//~^ ERROR mismatched types: expected `(bool,bool)`, found `&<generic #15>`
36+
//~^ ERROR mismatched types: expected `(bool,bool)`, found `&<generic #21>`
3737
// (expected tuple, found &-ptr)
3838
}
3939

src/test/run-fail/issue-5500.rs renamed to src/test/compile-fail/issue-5500.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:explicit failure
12-
1311
fn main() {
1412
&fail!()
13+
//~^ ERROR mismatched types: expected `()`, found `&<generic #2>` (expected (), found &-ptr)
1514
}

src/test/compile-fail/issue-897-2.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212

1313
fn g() -> ! { fail!(); }
1414
fn f() -> ! {
15-
return g();
16-
g(); //~ ERROR: unreachable statement
15+
return g(); //~ ERROR `return` in a function declared as diverging
16+
g();
17+
}
18+
fn h() -> ! {
19+
loop {}
20+
g();
1721
}
1822

1923
fn main() { f() }

src/test/compile-fail/issue-897.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: unreachable statement
12-
1311
#![deny(unreachable_code)]
1412

1513
fn f() -> ! {
16-
return fail!();
14+
return fail!(); //~ ERROR `return` in a function declared as diverging
1715
fail!(); // the unreachable statement error is in <std macro>, at this line, there
1816
// only is a note
1917
}

src/test/compile-fail/liveness-bad-bang-2.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
// except according to those terms.
1010

1111
// Tests that a function with a ! annotation always actually fails
12-
// error-pattern: some control paths may return
1312

14-
fn bad_bang(i: uint) -> ! { println!("{}", 3i); }
13+
fn bad_bang(i: uint) -> ! { //~ ERROR computation may converge in a function marked as diverging
14+
println!("{}", 3i);
15+
}
1516

1617
fn main() { bad_bang(5u); }

src/test/compile-fail/loop-does-not-diverge.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn forever() -> ! {
1414
loop {
1515
break;
1616
}
17-
return 42i; //~ ERROR expected `!`, found `int`
17+
return 42i; //~ ERROR `return` in a function declared as diverging
1818
}
1919

2020
fn main() {

src/test/compile-fail/lub-match.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ pub fn opt_str1<'a>(maybestr: &'a Option<String>) -> &'a str {
3333
}
3434

3535
pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
36-
match *maybestr { //~ ERROR cannot infer an appropriate lifetime for automatic coercion due to
36+
match *maybestr {
37+
//~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements
3738
None => "(none)",
3839
Some(ref s) => {
3940
let s: &'a str = s.as_slice();
@@ -43,7 +44,8 @@ pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
4344
}
4445

4546
pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
46-
match *maybestr { //~ ERROR cannot infer an appropriate lifetime for automatic coercion due to
47+
match *maybestr {
48+
//~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements
4749
Some(ref s) => {
4850
let s: &'a str = s.as_slice();
4951
s

src/test/run-pass/issue-13352.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ fn main() {
1717
unsafe { libc::exit(0 as libc::c_int); }
1818
});
1919
2u + (loop {});
20-
-(loop {});
2120
}

src/test/run-pass/unreachable-code.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ fn call_id_2() { id(true) && id(return); }
2323

2424
fn call_id_3() { id(return) && id(return); }
2525

26-
fn ret_ret() -> int { return (return 2i) + 3i; }
27-
2826
fn ret_guard() {
2927
match 2i {
3028
x if (return) => { x; }

0 commit comments

Comments
 (0)