diff options
author | John Hodge <tpg@mutabah.net> | 2017-01-05 18:08:43 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2017-01-05 18:08:43 +0800 |
commit | c7685abae7af1954bfbf5ce7ad350bc4aaa3d162 (patch) | |
tree | 43c8d3e287603b3db4525d0ee07233d062e9a918 /src/mir/cleanup.cpp | |
parent | 91f6be7bc4221dfe2fa2b1cdbed76063c860f3cf (diff) | |
download | mrust-c7685abae7af1954bfbf5ce7ad350bc4aaa3d162.tar.gz |
MIR Cleanup - DstMeta on arrays
Diffstat (limited to 'src/mir/cleanup.cpp')
-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. |