File tree Expand file tree Collapse file tree 7 files changed +21
-13
lines changed
trunk/src/test/compile-fail Expand file tree Collapse file tree 7 files changed +21
-13
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: ac4294a176f643c9c1f9bb992bf1b2f690499c30
2
+ refs/heads/master: 1d7d5c16b375872db6f798e2e4b2f5f8d533dec5
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
5
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
Original file line number Diff line number Diff line change 1
1
// -*- rust -*-
2
2
// Tests that a function with a ! annotation always actually fails
3
- // error-pattern: some control paths may return
4
3
5
- fn bad_bang ( i : uint ) -> ! { ret 7 u; }
4
+ fn bad_bang ( i : uint ) -> ! {
5
+ ret 7 u;
6
+ //!^ ERROR expected `_|_` but found `uint` (types differ)
7
+ }
6
8
7
9
fn main ( ) { bad_bang ( 5 u) ; }
Original file line number Diff line number Diff line change 1
1
// -*- rust -*-
2
2
// Tests that a function with a ! annotation always actually fails
3
- // error-pattern: may return to the caller
4
3
5
- fn bad_bang ( i : uint ) -> ! { if i < 0 u { } else { fail; } }
4
+ fn bad_bang ( i : uint ) -> ! {
5
+ if i < 0 u { } else { fail; }
6
+ //!^ ERROR expected `_|_` but found `()` (types differ)
7
+ }
6
8
7
9
fn main ( ) { bad_bang ( 5 u) ; }
Original file line number Diff line number Diff line change 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
+ }
3
4
fn main ( ) { }
Original file line number Diff line number Diff line change 1
- // error-pattern:in non-returning function f, some control paths may return
2
1
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
+ }
4
6
fn main ( ) { }
Original file line number Diff line number Diff line change 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
+ }
3
5
fn main ( ) { }
Original file line number Diff line number Diff line change 1
- // error-pattern:some control paths may return
2
1
/* Make sure a loop{} with a break in it can't be
3
2
the tailexpr in the body of a diverging function */
4
3
fn forever ( ) -> ! {
5
4
loop {
6
5
break ;
7
6
}
8
- ret 42 ;
7
+ ret 42 ; //! ERROR expected `_|_` but found `int` (types differ)
9
8
}
10
9
11
10
fn main ( ) {
You can’t perform that action at this time.
0 commit comments