summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-23 14:12:08 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-23 14:12:08 +0800
commit17b13384d44bb3b3e5ff8845c0ccf49f2751d0db (patch)
tree5f0ba03b1e20c9cb6b00b2f26049ff7c3ed87418 /src
parent0be06650864372bbee4c4a20f1859add2379270d (diff)
downloadmrust-17b13384d44bb3b3e5ff8845c0ccf49f2751d0db.tar.gz
MIR Gen Match - Fix a missing field access, and a bad type in slice matches
Diffstat (limited to 'src')
-rw-r--r--src/mir/from_hir_match.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mir/from_hir_match.cpp b/src/mir/from_hir_match.cpp
index 2c10e14b..0edc6800 100644
--- a/src/mir/from_hir_match.cpp
+++ b/src/mir/from_hir_match.cpp
@@ -2750,9 +2750,11 @@ void DecisionTreeGen::get_ty_and_val(
(Array,
assert(idx < e.size_val);
cur_ty = &*e.inner;
+ lval = ::MIR::LValue::make_Field({ box$(lval), idx });
),
(Slice,
cur_ty = &*e.inner;
+ lval = ::MIR::LValue::make_Field({ box$(lval), idx });
),
(Borrow,
ASSERT_BUG(sp, idx == FIELD_DEREF, "Destructure of borrow doesn't correspond to a deref in the path");
@@ -3317,12 +3319,12 @@ void DecisionTreeGen::generate_branches_Slice(
// - Binary search
// - Sequential comparisons
- auto val_len = m_builder.lvalue_or_temp(sp, ty, ::MIR::RValue::make_DstMeta({ val.clone() }));
+ auto val_len = m_builder.lvalue_or_temp(sp, ::HIR::CoreType::Usize, ::MIR::RValue::make_DstMeta({ val.clone() }));
// TODO: Binary search instead.
for( const auto& branch : branches.fixed_arms )
{
- auto val_des = m_builder.lvalue_or_temp(sp, ty, ::MIR::Constant(static_cast<uint64_t>(branch.first)));
+ auto val_des = m_builder.lvalue_or_temp(sp, ::HIR::CoreType::Usize, ::MIR::Constant(static_cast<uint64_t>(branch.first)));
// Special case - final just does equality
if( &branch == &branches.fixed_arms.back() )