aboutsummaryrefslogtreecommitdiff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <[email protected]>2011-04-11 15:35:01 -0400
committerRafael Ávila de Espíndola <[email protected]>2011-04-11 15:35:01 -0400
commitcca6335c26ce3ddacafd3e6079dc56c842856c3c (patch)
tree909b80973fb4aa6b8dd6a486aa6bf207945218dc /src/test/compile-fail
parentTry to fix the windows build. (diff)
downloadrust-cca6335c26ce3ddacafd3e6079dc56c842856c3c.tar.xz
rust-cca6335c26ce3ddacafd3e6079dc56c842856c3c.zip
Implement the "attempted dynamic environment-capture" error in rustc.
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/capture1.rs12
-rw-r--r--src/test/compile-fail/capture2.rs18
2 files changed, 30 insertions, 0 deletions
diff --git a/src/test/compile-fail/capture1.rs b/src/test/compile-fail/capture1.rs
new file mode 100644
index 00000000..fb1d82fe
--- /dev/null
+++ b/src/test/compile-fail/capture1.rs
@@ -0,0 +1,12 @@
+// -*- rust -*-
+
+// error-pattern: attempted dynamic environment-capture
+
+fn main() {
+
+ fn foo() -> int {
+ ret bar;
+ }
+
+ let int bar = 5;
+}
diff --git a/src/test/compile-fail/capture2.rs b/src/test/compile-fail/capture2.rs
new file mode 100644
index 00000000..1b088c69
--- /dev/null
+++ b/src/test/compile-fail/capture2.rs
@@ -0,0 +1,18 @@
+// -*- rust -*-
+
+// error-pattern: attempted dynamic environment-capture
+
+fn f(bool x) {
+}
+
+state obj foobar(bool x) {
+ drop {
+ auto y = x;
+ fn test() {
+ f(y);
+ }
+ }
+}
+
+fn main() {
+}