about summary refs log tree commit diff
path: root/src/test/ui/span
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-03-23 10:57:28 +0100
committerSimon Sapin <simon.sapin@exyr.org>2018-03-23 11:37:07 +0100
commitee67e14034438972c5aae46f8773fe69f20f14aa (patch)
tree2e06620d77b1082d1a9098f4a0530cf2c758decd /src/test/ui/span
parent52f7e8836cc2e6c0edfaf402ee40ca724a8c0989 (diff)
downloadrust-ee67e14034438972c5aae46f8773fe69f20f14aa.tar.gz
rust-ee67e14034438972c5aae46f8773fe69f20f14aa.zip
Stabilize the copy_closures and clone_closures features
In addition to the `Fn*` family of traits, closures now implement `Copy` (and similarly `Clone`) if all of the captures do.
Diffstat (limited to 'src/test/ui/span')
-rw-r--r--src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs5
-rw-r--r--src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr8
2 files changed, 8 insertions, 5 deletions
diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs
index 8e03c303e54..e8227971691 100644
--- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs
+++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs
@@ -58,7 +58,10 @@ fn test6() {
 
 fn test7() {
     fn foo<F>(_: F) where F: FnMut(Box<FnMut(isize)>, isize) {}
-    let mut f = |g: Box<FnMut(isize)>, b: isize| {};
+    let s = String::new();  // Capture to make f !Copy
+    let mut f = move |g: Box<FnMut(isize)>, b: isize| {
+        let _ = s.len();
+    };
     f(Box::new(|a| {
         foo(f);
         //~^ ERROR cannot move `f` into closure because it is borrowed
diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr
index 318b77dedcb..2e7e1e07441 100644
--- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr
+++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr
@@ -28,7 +28,7 @@ LL |     f.f.call_mut(())
    |     ^^^ cannot borrow as mutable
 
 error[E0504]: cannot move `f` into closure because it is borrowed
-  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:63:13
+  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13
    |
 LL |     f(Box::new(|a| {
    |     - borrow of `f` occurs here
@@ -36,11 +36,11 @@ LL |         foo(f);
    |             ^ move into closure occurs here
 
 error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
-  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:63:13
+  --> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13
    |
-LL |     let mut f = |g: Box<FnMut(isize)>, b: isize| {};
+LL |     let mut f = move |g: Box<FnMut(isize)>, b: isize| {
    |         ----- captured outer variable
-LL |     f(Box::new(|a| {
+...
 LL |         foo(f);
    |             ^ cannot move out of captured outer variable in an `FnMut` closure