Skip to content

Commit 6461cf3

Browse files
brsongraydon
authored andcommitted
Add compile-fail tests for tail calls
1 parent 378c008 commit 6461cf3

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ TEST_XFAILS_BOOT := $(TASK_XFAILS) \
434434
test/compile-fail/bad-recv.rs \
435435
test/compile-fail/bad-send.rs \
436436
test/compile-fail/infinite-vec-type-recursion.rs \
437+
test/compile-fail/tail-non-call.rs \
437438
test/compile-fail/writing-through-read-alias.rs
438439

439440
# Same strategy here for the time being: just list the ones that
@@ -555,6 +556,8 @@ TEST_XFAILS_RUSTC := $(filter-out \
555556
multiline-comment-line-tracking.rs \
556557
output-type-mismatch.rs \
557558
rec-missing-fields.rs \
559+
tail-non-call.rs \
560+
tail-typeck.rs \
558561
type-shadow.rs \
559562
while-type-error.rs \
560563
wrong-ret-type.rs \
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// error-pattern: Non-call expression in tail call
2+
3+
fn f() -> int {
4+
auto x = 1;
5+
be x;
6+
}
7+
8+
fn main() {
9+
auto y = f();
10+
}

src/test/compile-fail/tail-typeck.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// error-pattern: mismatched types
2+
3+
fn f() -> int {
4+
be g();
5+
}
6+
7+
fn g() -> uint {
8+
ret 0u;
9+
}
10+
11+
fn main() {
12+
auto y = f();
13+
}

0 commit comments

Comments
 (0)