aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-01-30 17:38:46 -0500
committerGraydon Hoare <[email protected]>2011-02-10 12:12:10 -0800
commit6461cf30de748fbe310640cd9c195965fc3da229 (patch)
tree62e06953c60f2e2a8a4c1ae55eb483a238a957d5 /src
parentParse 'be' statement. Pass tailcall tests. No actual tailcalls yet. (diff)
downloadrust-6461cf30de748fbe310640cd9c195965fc3da229.tar.xz
rust-6461cf30de748fbe310640cd9c195965fc3da229.zip
Add compile-fail tests for tail calls
Diffstat (limited to 'src')
-rw-r--r--src/Makefile3
-rw-r--r--src/test/compile-fail/tail-non-call.rs10
-rw-r--r--src/test/compile-fail/tail-typeck.rs13
3 files changed, 26 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile
index 5c3f297f..7a31c24a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -434,6 +434,7 @@ TEST_XFAILS_BOOT := $(TASK_XFAILS) \
test/compile-fail/bad-recv.rs \
test/compile-fail/bad-send.rs \
test/compile-fail/infinite-vec-type-recursion.rs \
+ test/compile-fail/tail-non-call.rs \
test/compile-fail/writing-through-read-alias.rs
# Same strategy here for the time being: just list the ones that
@@ -555,6 +556,8 @@ TEST_XFAILS_RUSTC := $(filter-out \
multiline-comment-line-tracking.rs \
output-type-mismatch.rs \
rec-missing-fields.rs \
+ tail-non-call.rs \
+ tail-typeck.rs \
type-shadow.rs \
while-type-error.rs \
wrong-ret-type.rs \
diff --git a/src/test/compile-fail/tail-non-call.rs b/src/test/compile-fail/tail-non-call.rs
new file mode 100644
index 00000000..2742d1fe
--- /dev/null
+++ b/src/test/compile-fail/tail-non-call.rs
@@ -0,0 +1,10 @@
+// error-pattern: Non-call expression in tail call
+
+fn f() -> int {
+ auto x = 1;
+ be x;
+}
+
+fn main() {
+ auto y = f();
+} \ No newline at end of file
diff --git a/src/test/compile-fail/tail-typeck.rs b/src/test/compile-fail/tail-typeck.rs
new file mode 100644
index 00000000..10b95546
--- /dev/null
+++ b/src/test/compile-fail/tail-typeck.rs
@@ -0,0 +1,13 @@
+// error-pattern: mismatched types
+
+fn f() -> int {
+ be g();
+}
+
+fn g() -> uint {
+ ret 0u;
+}
+
+fn main() {
+ auto y = f();
+} \ No newline at end of file