From 1d7d5c16b375872db6f798e2e4b2f5f8d533dec5 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 24 Mar 2012 22:15:34 -0700 Subject: [PATCH] correct more broken tests --- src/test/compile-fail/bad-bang-ann-3.rs | 6 ++++-- src/test/compile-fail/bad-bang-ann.rs | 6 ++++-- src/test/compile-fail/bang-tailexpr.rs | 5 +++-- src/test/compile-fail/issue-897-2.rs | 6 ++++-- src/test/compile-fail/issue-897.rs | 6 ++++-- src/test/compile-fail/loop-does-not-diverge.rs | 3 +-- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/test/compile-fail/bad-bang-ann-3.rs b/src/test/compile-fail/bad-bang-ann-3.rs index 2ba862ff57f..ded6f62a6dd 100644 --- a/src/test/compile-fail/bad-bang-ann-3.rs +++ b/src/test/compile-fail/bad-bang-ann-3.rs @@ -1,7 +1,9 @@ // -*- rust -*- // Tests that a function with a ! annotation always actually fails -// error-pattern: some control paths may return -fn bad_bang(i: uint) -> ! { ret 7u; } +fn bad_bang(i: uint) -> ! { + ret 7u; + //!^ ERROR expected `_|_` but found `uint` (types differ) +} fn main() { bad_bang(5u); } diff --git a/src/test/compile-fail/bad-bang-ann.rs b/src/test/compile-fail/bad-bang-ann.rs index e67013998a1..f5ec75c59fa 100644 --- a/src/test/compile-fail/bad-bang-ann.rs +++ b/src/test/compile-fail/bad-bang-ann.rs @@ -1,7 +1,9 @@ // -*- rust -*- // Tests that a function with a ! annotation always actually fails -// error-pattern: may return to the caller -fn bad_bang(i: uint) -> ! { if i < 0u { } else { fail; } } +fn bad_bang(i: uint) -> ! { + if i < 0u { } else { fail; } + //!^ ERROR expected `_|_` but found `()` (types differ) +} fn main() { bad_bang(5u); } diff --git a/src/test/compile-fail/bang-tailexpr.rs b/src/test/compile-fail/bang-tailexpr.rs index d13fca4486c..20b147cb5e3 100644 --- a/src/test/compile-fail/bang-tailexpr.rs +++ b/src/test/compile-fail/bang-tailexpr.rs @@ -1,3 +1,4 @@ -// error-pattern: some control paths may return -fn f() -> ! { 3 } +fn f() -> ! { + 3 //! ERROR expected `_|_` but found `int` (types differ) +} fn main() { } diff --git a/src/test/compile-fail/issue-897-2.rs b/src/test/compile-fail/issue-897-2.rs index b2b0c0d3597..9b8f85fc668 100644 --- a/src/test/compile-fail/issue-897-2.rs +++ b/src/test/compile-fail/issue-897-2.rs @@ -1,4 +1,6 @@ -// error-pattern:in non-returning function f, some control paths may return fn g() -> ! { fail; } -fn f() -> ! { ret 42; g(); } +fn f() -> ! { + ret 42; //! ERROR expected `_|_` but found `int` (types differ) + g(); //! WARNING unreachable statement +} fn main() { } diff --git a/src/test/compile-fail/issue-897.rs b/src/test/compile-fail/issue-897.rs index 7a27b0e51fd..6521f5159a9 100644 --- a/src/test/compile-fail/issue-897.rs +++ b/src/test/compile-fail/issue-897.rs @@ -1,3 +1,5 @@ -// error-pattern:in non-returning function f, some control paths may return -fn f() -> ! { ret 42; fail; } +fn f() -> ! { + ret 42; //! ERROR expected `_|_` but found `int` (types differ) + fail; //! WARNING unreachable statement +} fn main() { } diff --git a/src/test/compile-fail/loop-does-not-diverge.rs b/src/test/compile-fail/loop-does-not-diverge.rs index 3d2d70fbab8..eaaa4ecc9fb 100644 --- a/src/test/compile-fail/loop-does-not-diverge.rs +++ b/src/test/compile-fail/loop-does-not-diverge.rs @@ -1,11 +1,10 @@ -// error-pattern:some control paths may return /* Make sure a loop{} with a break in it can't be the tailexpr in the body of a diverging function */ fn forever() -> ! { loop { break; } - ret 42; + ret 42; //! ERROR expected `_|_` but found `int` (types differ) } fn main() {