Skip to content

Commit 1d7d5c1

Browse files
committed
correct more broken tests
1 parent ac4294a commit 1d7d5c1

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed
+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// -*- rust -*-
22
// Tests that a function with a ! annotation always actually fails
3-
// error-pattern: some control paths may return
43

5-
fn bad_bang(i: uint) -> ! { ret 7u; }
4+
fn bad_bang(i: uint) -> ! {
5+
ret 7u;
6+
//!^ ERROR expected `_|_` but found `uint` (types differ)
7+
}
68

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

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// -*- rust -*-
22
// Tests that a function with a ! annotation always actually fails
3-
// error-pattern: may return to the caller
43

5-
fn bad_bang(i: uint) -> ! { if i < 0u { } else { fail; } }
4+
fn bad_bang(i: uint) -> ! {
5+
if i < 0u { } else { fail; }
6+
//!^ ERROR expected `_|_` but found `()` (types differ)
7+
}
68

79
fn main() { bad_bang(5u); }
+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
// error-pattern: some control paths may return
2-
fn f() -> ! { 3 }
1+
fn f() -> ! {
2+
3 //! ERROR expected `_|_` but found `int` (types differ)
3+
}
34
fn main() { }

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// error-pattern:in non-returning function f, some control paths may return
21
fn g() -> ! { fail; }
3-
fn f() -> ! { ret 42; g(); }
2+
fn f() -> ! {
3+
ret 42; //! ERROR expected `_|_` but found `int` (types differ)
4+
g(); //! WARNING unreachable statement
5+
}
46
fn main() { }

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
// error-pattern:in non-returning function f, some control paths may return
2-
fn f() -> ! { ret 42; fail; }
1+
fn f() -> ! {
2+
ret 42; //! ERROR expected `_|_` but found `int` (types differ)
3+
fail; //! WARNING unreachable statement
4+
}
35
fn main() { }

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
// error-pattern:some control paths may return
21
/* Make sure a loop{} with a break in it can't be
32
the tailexpr in the body of a diverging function */
43
fn forever() -> ! {
54
loop {
65
break;
76
}
8-
ret 42;
7+
ret 42; //! ERROR expected `_|_` but found `int` (types differ)
98
}
109

1110
fn main() {

0 commit comments

Comments
 (0)