From 5f154770e2e921e717127b9fe95e09856305fd6f Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Wed, 23 May 2012 15:46:43 -0700 Subject: Prevent capturing non-copyable things in closures. --- src/rustc/middle/kind.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/rustc') diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs index effa593109c..b350d34781a 100644 --- a/src/rustc/middle/kind.rs +++ b/src/rustc/middle/kind.rs @@ -71,6 +71,9 @@ fn with_appropriate_checker(cx: ctx, id: node_id, b: fn(check_fn)) { // moved in or copied in check_send(cx, var_t, sp); + // copied in data must be copyable, but moved in data can be anything + if !is_move { check_copy(cx, var_t, sp); } + // check that only immutable variables are implicitly copied in if !is_move { for fv.each { |fv| -- cgit 1.4.1-3-g733a5