aboutsummaryrefslogtreecommitdiff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorMarijn Haverbeke <[email protected]>2011-05-13 11:57:58 +0200
committerMarijn Haverbeke <[email protected]>2011-05-13 12:44:05 +0200
commit58ec5d1654f367d7f3459ebee2b5f4c89e0f3aa1 (patch)
tree803ad4b840000f5af60041d6c565f210f12bf7a1 /src/test/compile-fail
parentChange resolve to use walk instead of fold (diff)
downloadrust-58ec5d1654f367d7f3459ebee2b5f4c89e0f3aa1.tar.xz
rust-58ec5d1654f367d7f3459ebee2b5f4c89e0f3aa1.zip
Move capture checking into resolve.rs
Drops capture.rs. The new algorithm also checks for captures function arguments and obj fields.
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/bad-env-capture.rs1
-rw-r--r--src/test/compile-fail/bad-env-capture2.rs11
-rw-r--r--src/test/compile-fail/bad-env-capture3.rs14
3 files changed, 25 insertions, 1 deletions
diff --git a/src/test/compile-fail/bad-env-capture.rs b/src/test/compile-fail/bad-env-capture.rs
index 55fa7473..fa1e1d08 100644
--- a/src/test/compile-fail/bad-env-capture.rs
+++ b/src/test/compile-fail/bad-env-capture.rs
@@ -1,6 +1,5 @@
// xfail-stage0
// xfail-stage1
-// xfail-stage2
// error-pattern: attempted dynamic environment-capture
fn foo() {
let int x;
diff --git a/src/test/compile-fail/bad-env-capture2.rs b/src/test/compile-fail/bad-env-capture2.rs
new file mode 100644
index 00000000..ccec3310
--- /dev/null
+++ b/src/test/compile-fail/bad-env-capture2.rs
@@ -0,0 +1,11 @@
+// xfail-stage0
+// xfail-stage1
+// error-pattern: attempted dynamic environment-capture
+fn foo(int x) {
+ fn bar() {
+ log x;
+ }
+}
+fn main() {
+ foo(2);
+} \ No newline at end of file
diff --git a/src/test/compile-fail/bad-env-capture3.rs b/src/test/compile-fail/bad-env-capture3.rs
new file mode 100644
index 00000000..77f7881d
--- /dev/null
+++ b/src/test/compile-fail/bad-env-capture3.rs
@@ -0,0 +1,14 @@
+// xfail-stage0
+// xfail-stage1
+// error-pattern: attempted dynamic environment-capture
+obj foo(int x) {
+ fn mth() {
+ fn bar() {
+ log x;
+ }
+ }
+}
+
+fn main() {
+ foo(2);
+}