about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Koropoff <bkoropoff@gmail.com>2014-11-06 20:40:32 -0800
committerBrian Koropoff <bkoropoff@gmail.com>2014-11-06 20:40:32 -0800
commitc3c72239b7130b947deb6272c6d0c05872697d91 (patch)
tree97383144cef90d2f838c30036df5b419ab4ec82f
parentb03a2755193cd756583bcf5831cf4545d75ecb8a (diff)
downloadrust-c3c72239b7130b947deb6272c6d0c05872697d91.tar.gz
rust-c3c72239b7130b947deb6272c6d0c05872697d91.zip
Remove incorrect assert in trans
As an optimization, once unboxed closures receive their environment by
value if it fits within the size of an `int`.  An assert in this code
path assumed that this would only occur if the environment had no more
than a single free variable in it, but multiple smaller free variables
can easily be packed into the space of an `int`, particularly if any
of them are 0-sized.  The assert can simply be removed.

Closes #18652
-rw-r--r--src/librustc/middle/trans/closure.rs1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs
index 16db4daba46..4f6d4ab6a24 100644
--- a/src/librustc/middle/trans/closure.rs
+++ b/src/librustc/middle/trans/closure.rs
@@ -322,7 +322,6 @@ fn load_unboxed_closure_environment<'blk, 'tcx>(
                                          self_type,
                                          "unboxed_closure_env");
         store_ty(bcx, bcx.fcx.llenv.unwrap(), datum.val, self_type);
-        assert!(freevars.len() <= 1);
         datum.val
     } else {
         bcx.fcx.llenv.unwrap()