diff options
| author | Brian Anderson <andersrb@gmail.com> | 2011-01-30 17:38:46 -0500 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-02-10 12:12:10 -0800 |
| commit | 6461cf30de748fbe310640cd9c195965fc3da229 (patch) | |
| tree | 62e06953c60f2e2a8a4c1ae55eb483a238a957d5 | |
| parent | 378c0087ca7572cd17726c704fe04d57bf4687af (diff) | |
| download | rust-6461cf30de748fbe310640cd9c195965fc3da229.tar.gz rust-6461cf30de748fbe310640cd9c195965fc3da229.zip | |
Add compile-fail tests for tail calls
| -rw-r--r-- | src/Makefile | 3 | ||||
| -rw-r--r-- | src/test/compile-fail/tail-non-call.rs | 10 | ||||
| -rw-r--r-- | src/test/compile-fail/tail-typeck.rs | 13 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile index 5c3f297f788..7a31c24a041 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 00000000000..2742d1fe89d --- /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 00000000000..10b95546f22 --- /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 |
