summaryrefslogtreecommitdiff
path: root/src/mir/cleanup.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2018-05-12 19:04:09 +0800
committerJohn Hodge <tpg@mutabah.net>2018-05-12 19:04:09 +0800
commit5de0393d29ac0e7eb3ede52fe665fd49ac412f21 (patch)
treee22092763d7640067f109ea515ecc9575886dcbb /src/mir/cleanup.cpp
parent6a56c4c2fb5be1fc6dae05da6bff936ce75553de (diff)
downloadmrust-5de0393d29ac0e7eb3ede52fe665fd49ac412f21.tar.gz
MIR Cleanup - Remove cast of PhantomData
Diffstat (limited to 'src/mir/cleanup.cpp')
-rw-r--r--src/mir/cleanup.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/mir/cleanup.cpp b/src/mir/cleanup.cpp
index 019a0796..2d4b3468 100644
--- a/src/mir/cleanup.cpp
+++ b/src/mir/cleanup.cpp
@@ -764,7 +764,7 @@ bool MIR_Cleanup_Unsize_GetMetadata(const ::MIR::TypeResolve& state, MirMutator&
{
auto ty_d = monomorphise_type_with(state.sp, se[i].ent, monomorph_cb_d, false);
- auto new_rval = ::MIR::RValue::make_Cast({ ::MIR::LValue::make_Field({ box$(value.clone()), i }), ty_d.clone() });
+ auto new_rval = ::MIR::RValue::make_Struct({ ty_d.m_data.as_Path().path.m_data.as_Generic().clone(), {} });
auto new_lval = mutator.in_temporary( mv$(ty_d), mv$(new_rval) );
ents.push_back( mv$(new_lval) );
@@ -794,7 +794,7 @@ bool MIR_Cleanup_Unsize_GetMetadata(const ::MIR::TypeResolve& state, MirMutator&
{
auto ty_d = monomorphise_type_with(state.sp, se[i].second.ent, monomorph_cb_d, false);
- auto new_rval = ::MIR::RValue::make_Cast({ ::MIR::LValue::make_Field({ box$(value.clone()), i }), ty_d.clone() });
+ auto new_rval = ::MIR::RValue::make_Struct({ ty_d.m_data.as_Path().path.m_data.as_Generic().clone(), {} });
auto new_lval = mutator.in_temporary( mv$(ty_d), mv$(new_rval) );
ents.push_back( mv$(new_lval) );
@@ -1079,12 +1079,6 @@ void MIR_Cleanup(const StaticTraitResolve& resolve, const ::HIR::ItemPath& path,
// TODO Share with the CoerceUnsized handling?
se.src = MIR_Cleanup_CoerceUnsized(state, mutator, e.type, src_ty, mv$(e.val));
)
- // Casts to PhantomData are only valid from PhandomData, and are added by _CoerceUnsized
- else if( state.m_resolve.is_type_phantom_data(e.type) )
- {
- // Leave
- MIR_ASSERT(state, state.m_resolve.is_type_phantom_data(src_ty) != nullptr, "PhandomData can only cast from PhantomData");
- }
// - CoerceUnsized should re-create the inner type if known.
else TU_IFLET( ::HIR::TypeRef::Data, e.type.m_data, Path, te,
TU_IFLET( ::HIR::TypeRef::Data, src_ty.m_data, Path, ste,