about summary refs log tree commit diff
path: root/src/librustc/util
diff options
context:
space:
mode:
authorBrian Koropoff <bkoropoff@gmail.com>2014-10-18 10:46:57 -0700
committerBrian Koropoff <bkoropoff@gmail.com>2014-10-27 18:51:27 -0700
commitf0cc3a93651d237a8c5dda1571e823a3cba7ce60 (patch)
tree5df482458ebd1db8905bdbb1aa1cda0fafd68d7e /src/librustc/util
parentbd7138dd698dde29fb4d7fd34529a863b85d947e (diff)
downloadrust-f0cc3a93651d237a8c5dda1571e823a3cba7ce60.tar.gz
rust-f0cc3a93651d237a8c5dda1571e823a3cba7ce60.zip
Fix monomorphization of unboxed closures
This adds a `Substs` field to `ty_unboxed_closure` and plumbs basic
handling of it throughout the compiler. trans now correctly
monomorphizes captured free variables and llvm function defs.  This
fixes uses of unboxed closures which reference a free type or region
parameter from their environment in either their signature or free
variables.  Closes #16791
Diffstat (limited to 'src/librustc/util')
-rw-r--r--src/librustc/util/ppaux.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index 81deae86faa..943570743e8 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -425,7 +425,12 @@ pub fn ty_to_string(cx: &ctxt, typ: t) -> String {
                   bound_str)
       }
       ty_str => "str".to_string(),
-      ty_unboxed_closure(..) => "closure".to_string(),
+      ty_unboxed_closure(ref did, _, ref substs) => {
+          let unboxed_closures = cx.unboxed_closures.borrow();
+          unboxed_closures.find(did).map(|cl| {
+              closure_to_string(cx, &cl.closure_type.subst(cx, substs))
+          }).unwrap_or_else(|| "closure".to_string())
+      }
       ty_vec(t, sz) => {
           match sz {
               Some(n) => {