summaryrefslogtreecommitdiff
path: root/src/mir/from_hir_match.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-24 18:00:38 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-24 18:00:38 +0800
commitf84f2971e145b582425f2d74b4d99416fbe34f33 (patch)
tree6cb749de00beea75ce540eacbd94c3a2ce69c383 /src/mir/from_hir_match.cpp
parent2f6b01e92050e9b0df1eb487b4d4f1644c8626a4 (diff)
downloadmrust-f84f2971e145b582425f2d74b4d99416fbe34f33.tar.gz
MIR Gen Match - Fix edge case where DTN simplify didn't work
Diffstat (limited to 'src/mir/from_hir_match.cpp')
-rw-r--r--src/mir/from_hir_match.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mir/from_hir_match.cpp b/src/mir/from_hir_match.cpp
index d9c33d5f..c7c0ad8f 100644
--- a/src/mir/from_hir_match.cpp
+++ b/src/mir/from_hir_match.cpp
@@ -1601,6 +1601,14 @@ void DecisionTreeNode::simplify()
TU_MATCHA( (m_branches), (e),
(Unset,
+ H::simplify_branch(m_default);
+ // Replace `this` with `m_default` if `m_default` is a subtree
+ // - Fixes the edge case for the top of the tree
+ if( m_default.is_Subtree() )
+ {
+ *this = mv$(*m_default.as_Subtree());
+ }
+ return ;
),
(Bool,
H::simplify_branch(e.false_branch);