diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index e4a35a8d6b6..bae944659d9 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -958,10 +958,13 @@ fn get_derived_tydesc(cx: &@block_ctxt, t: ty::t, escapes: bool, // If the tydesc escapes in this context, the cached derived // tydesc also has to be one that was marked as escaping. - if !(escapes && !info.escapes) { ret rslt(cx, info.lltydesc); } + if !(escapes && !info.escapes) && storage == tps_normal { + ret rslt(cx, info.lltydesc); + } } none. {/* fall through */ } } + bcx_ccx(cx).stats.n_derived_tydescs += 1u; let bcx = new_raw_block_ctxt(cx.fcx, cx.fcx.llderivedtydescs); let tys = linearize_ty_params(bcx, t); diff --git a/src/rt/rust_crate_cache.cpp b/src/rt/rust_crate_cache.cpp index ba5a104b024..035715d219f 100644 --- a/src/rt/rust_crate_cache.cpp +++ b/src/rt/rust_crate_cache.cpp @@ -1,5 +1,6 @@ #include "rust_internal.h" +#include type_desc * rust_crate_cache::get_type_desc(size_t size, @@ -14,6 +15,10 @@ rust_crate_cache::get_type_desc(size_t size, HASH_FIND(hh, this->type_descs, descs, keysz, td); if (td) { DLOG(sched, cache, "rust_crate_cache::get_type_desc hit"); + + // FIXME: This is a gross hack. + td->n_obj_params = std::max(td->n_obj_params, n_obj_params); + return td; } DLOG(sched, cache, "rust_crate_cache::get_type_desc miss"); diff --git a/src/rt/rust_shape.h b/src/rt/rust_shape.h index 0302338e26d..e8a30d5874a 100644 --- a/src/rt/rust_shape.h +++ b/src/rt/rust_shape.h @@ -259,6 +259,9 @@ public: // Creates type parameters from a type descriptor. static inline type_param *from_tydesc(const type_desc *tydesc, arena &arena) { + if (tydesc->n_obj_params) { + // TODO + } return make(tydesc->first_param, tydesc->n_params, arena); } };