Skip to content

Commit 86c05ac

Browse files
committed
---
yaml --- r: 2700 b: refs/heads/master c: 7b4eec2 h: refs/heads/master v: v3
1 parent f2f5022 commit 86c05ac

File tree

5 files changed

+59
-1
lines changed

5 files changed

+59
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: a1b440baaaa2c35f2c32939c44451f25cbe92e3a
2+
refs/heads/master: 7b4eec215ccee45fc4a2c23bcb127951ae5250af
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// -*- rust -*-
2+
// xfail-stage0
3+
// Tests that a function with a ! annotation always actually fails
4+
// error-pattern: some control paths may return
5+
6+
fn bad_bang(uint i) -> ! {
7+
log 3;
8+
}
9+
10+
fn main() {
11+
bad_bang(5u);
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// -*- rust -*-
2+
// xfail-stage0
3+
// Tests that a function with a ! annotation always actually fails
4+
// error-pattern: some control paths may return
5+
6+
fn bad_bang(uint i) -> ! {
7+
ret 7u;
8+
}
9+
10+
fn main() {
11+
bad_bang(5u);
12+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// -*- rust -*-
2+
// xfail-stage0
3+
// Tests that a function with a ! annotation always actually fails
4+
// error-pattern: may return to the caller
5+
6+
fn bad_bang(uint i) -> ! {
7+
if (i < 0u) {
8+
}
9+
else {
10+
fail;
11+
}
12+
}
13+
14+
fn main() {
15+
bad_bang(5u);
16+
}

trunk/src/test/run-pass/ret-bang.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// -*- rust -*-
2+
fn my_err(str s) -> ! {
3+
log_err s;
4+
fail;
5+
}
6+
7+
fn okay(uint i) -> int {
8+
if (i == 3u) {
9+
my_err("I don't like three");
10+
}
11+
else {
12+
ret 42;
13+
}
14+
}
15+
16+
fn main() {
17+
okay(4u);
18+
}

0 commit comments

Comments
 (0)