summaryrefslogtreecommitdiff
path: root/src/mir/from_hir_match.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-12-31 14:07:45 +0800
committerJohn Hodge <tpg@mutabah.net>2016-12-31 14:07:45 +0800
commit5deed177a5a6fcd7bad86c8dd4f5866f7b578de3 (patch)
tree5e5ed81e55a0c6a89ab51ff5127adb0ae5607357 /src/mir/from_hir_match.cpp
parent7ef1d63e51f4fa14def0a1fabe7a988e5d50ec82 (diff)
downloadmrust-5deed177a5a6fcd7bad86c8dd4f5866f7b578de3.tar.gz
MIR - Fix a bit of invalid MIR
Diffstat (limited to 'src/mir/from_hir_match.cpp')
-rw-r--r--src/mir/from_hir_match.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mir/from_hir_match.cpp b/src/mir/from_hir_match.cpp
index 183d6418..008bef0c 100644
--- a/src/mir/from_hir_match.cpp
+++ b/src/mir/from_hir_match.cpp
@@ -3677,6 +3677,8 @@ void DecisionTreeGen::generate_branches_Slice(
ERROR(sp, E0000, "Non-exhaustive match over " << ty);
}
+ auto val_len = m_builder.lvalue_or_temp(sp, ::HIR::CoreType::Usize, ::MIR::RValue::make_DstMeta({ val.clone() }));
+
// NOTE: Un-deref the slice
ASSERT_BUG(sp, val.is_Deref(), "slice matches must be passed a deref");
auto tmp = mv$( *val.as_Deref().val );
@@ -3689,8 +3691,6 @@ void DecisionTreeGen::generate_branches_Slice(
// - Binary search
// - Sequential comparisons
- 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 )
{