about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-03-02 21:36:33 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-03-03 01:48:58 +0530
commitc4b1500fec44c4ed967542fda3cd9c104addbb80 (patch)
treec0f79ec53e9f9ca46755b5ddccc42e67ebbb69a7 /src/test/compile-fail
parentf608afe4707aaf5c87a39d43c3708c743d070406 (diff)
parent00fcf794488e5e1a4761342dac7d2bcdfb66152f (diff)
downloadrust-c4b1500fec44c4ed967542fda3cd9c104addbb80.tar.gz
rust-c4b1500fec44c4ed967542fda3cd9c104addbb80.zip
Rollup merge of #22966 - nikomatsakis:closure-region-hierarchy, r=pnkfelix
 Remove the synthetic \"region bound\" from closures and instead update how
type-outlives works for closure types so that it ensures that all upvars
outlive the region in question. This gives the same guarantees but
without introducing artificial regions (and gives better error messages
to boot). This is refactoring towards #3696.

r? @pnkfelix
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/issue-4335.rs4
-rw-r--r--src/test/compile-fail/regions-proc-bound-capture.rs2
-rw-r--r--src/test/compile-fail/regions-steal-closure.rs4
-rwxr-xr-xsrc/test/compile-fail/send-is-not-static-ensures-scoping.rs5
-rw-r--r--src/test/compile-fail/unboxed-closure-region.rs2
5 files changed, 10 insertions, 7 deletions
diff --git a/src/test/compile-fail/issue-4335.rs b/src/test/compile-fail/issue-4335.rs
index d0da51373d9..85298e4c6e0 100644
--- a/src/test/compile-fail/issue-4335.rs
+++ b/src/test/compile-fail/issue-4335.rs
@@ -14,7 +14,9 @@
 fn id<T>(t: T) -> T { t }
 
 fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
-    id(box || *v) //~ ERROR cannot infer
+    id(box || *v)
+        //~^ ERROR `v` does not live long enough
+        //~| ERROR cannot move out of borrowed content
 }
 
 fn main() {
diff --git a/src/test/compile-fail/regions-proc-bound-capture.rs b/src/test/compile-fail/regions-proc-bound-capture.rs
index 7ea4d1c7507..cc33d112417 100644
--- a/src/test/compile-fail/regions-proc-bound-capture.rs
+++ b/src/test/compile-fail/regions-proc-bound-capture.rs
@@ -18,7 +18,7 @@ fn borrowed_proc<'a>(x: &'a isize) -> Box<FnMut()->(isize) + 'a> {
 
 fn static_proc(x: &isize) -> Box<FnMut()->(isize) + 'static> {
     // This is illegal, because the region bound on `proc` is 'static.
-    box move|| { *x } //~ ERROR cannot infer
+    box move|| { *x } //~ ERROR captured variable `x` does not outlive the enclosing closure
 }
 
 fn main() { }
diff --git a/src/test/compile-fail/regions-steal-closure.rs b/src/test/compile-fail/regions-steal-closure.rs
index 97b51fdb325..c9b378d1df2 100644
--- a/src/test/compile-fail/regions-steal-closure.rs
+++ b/src/test/compile-fail/regions-steal-closure.rs
@@ -20,9 +20,9 @@ fn box_it<'r>(x: Box<FnMut() + 'r>) -> closure_box<'r> {
 }
 
 fn main() {
-    let cl_box = {
+    let mut cl_box = {
         let mut i = 3;
-        box_it(box || i += 1) //~ ERROR cannot infer
+        box_it(box || i += 1) //~ ERROR `i` does not live long enough
     };
     cl_box.cl.call_mut(());
 }
diff --git a/src/test/compile-fail/send-is-not-static-ensures-scoping.rs b/src/test/compile-fail/send-is-not-static-ensures-scoping.rs
index abbcd7e4590..fe03ca8353d 100755
--- a/src/test/compile-fail/send-is-not-static-ensures-scoping.rs
+++ b/src/test/compile-fail/send-is-not-static-ensures-scoping.rs
@@ -13,9 +13,10 @@ use std::thread;
 fn main() {
     let bad = {
         let x = 1;
-        let y = &x;
+        let y = &x; //~ ERROR `x` does not live long enough
 
-        thread::scoped(|| { //~ ERROR cannot infer an appropriate lifetime
+        thread::scoped(|| {
+            //~^ ERROR `y` does not live long enough
             let _z = y;
         })
     };
diff --git a/src/test/compile-fail/unboxed-closure-region.rs b/src/test/compile-fail/unboxed-closure-region.rs
index 59c84953718..5f4bf0d33be 100644
--- a/src/test/compile-fail/unboxed-closure-region.rs
+++ b/src/test/compile-fail/unboxed-closure-region.rs
@@ -15,6 +15,6 @@
 fn main() {
     let _f = {
         let x = 0_usize;
-        || x //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements
+        || x //~ ERROR `x` does not live long enough
     };
 }