diff options
| author | Eric Holk <eric.holk@gmail.com> | 2012-05-23 15:46:43 -0700 |
|---|---|---|
| committer | Eric Holk <eric.holk@gmail.com> | 2012-05-23 15:46:43 -0700 |
| commit | 5f154770e2e921e717127b9fe95e09856305fd6f (patch) | |
| tree | c6e4f63c6032bef8384a4010a92ac0c148febf3a /src/rustc | |
| parent | 6fa1a084f7714023c4594ec7a857359824dc3253 (diff) | |
| download | rust-5f154770e2e921e717127b9fe95e09856305fd6f.tar.gz rust-5f154770e2e921e717127b9fe95e09856305fd6f.zip | |
Prevent capturing non-copyable things in closures.
Diffstat (limited to 'src/rustc')
| -rw-r--r-- | src/rustc/middle/kind.rs | 3 |
1 files changed, 3 insertions, 0 deletions
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| |
