diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mir/cleanup.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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. |