From c7685abae7af1954bfbf5ce7ad350bc4aaa3d162 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 5 Jan 2017 18:08:43 +0800 Subject: MIR Cleanup - DstMeta on arrays --- src/mir/cleanup.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/mir/cleanup.cpp') diff --git a/src/mir/cleanup.cpp b/src/mir/cleanup.cpp index 8056ae27..267667db 100644 --- a/src/mir/cleanup.cpp +++ b/src/mir/cleanup.cpp @@ -915,6 +915,14 @@ void MIR_Cleanup(const StaticTraitResolve& resolve, const ::HIR::ItemPath& path, auto v = ::MIR::LValue::make_Deref({ box$(re.val) }); MIR_Cleanup_LValue(state, mutator, v); re.val = mv$( *v.as_Deref().val ); + + // If the type is an array (due to a monomorpised generic?) then replace. + ::HIR::TypeRef tmp; + const auto& ty = state.get_lvalue_type(tmp, re.val); + const auto& ity = *ty.m_data.as_Borrow().inner; + if( const auto* te = ity.m_data.opt_Array() ) { + se.src = ::MIR::Constant::make_Uint( te->size_val ); + } ), (DstPtr, // HACK: Ensure that the box Deref conversion fires here. -- cgit v1.2.3