From 82a7cd1be6e73d7c8fc40a552120e9e34a92f9db Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 19 Nov 2016 17:32:16 +0800 Subject: MIR Gen Match - Fix bad type for string in simple --- src/mir/from_hir_match.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mir/from_hir_match.cpp b/src/mir/from_hir_match.cpp index 2c7ffcc7..860bb5bb 100644 --- a/src/mir/from_hir_match.cpp +++ b/src/mir/from_hir_match.cpp @@ -1444,8 +1444,8 @@ int MIR_LowerHIR_Match_Simple__GeneratePattern(MirBuilder& builder, const Span& auto succ_bb = builder.new_bb_unlinked(); - auto test_lval = builder.lvalue_or_temp(sp, ty.clone(), ::MIR::RValue(::MIR::Constant( v.as_StaticString() ))); - auto cmp_lval = builder.lvalue_or_temp(sp, ::HIR::CoreType::Bool, ::MIR::RValue::make_BinOp({ val.clone(), ::MIR::eBinOp::EQ, mv$(test_lval) })); + auto test_lval = builder.lvalue_or_temp(sp, ::HIR::TypeRef::new_borrow(::HIR::BorrowType::Shared, ty.clone()), ::MIR::RValue(::MIR::Constant( v.as_StaticString() ))); + auto cmp_lval = builder.lvalue_or_temp(sp, ::HIR::CoreType::Bool, ::MIR::RValue::make_BinOp({ val.clone(), ::MIR::eBinOp::EQ, ::MIR::LValue::make_Deref({box$(test_lval)}) })); builder.end_block( ::MIR::Terminator::make_If({ mv$(cmp_lval), succ_bb, fail_bb }) ); builder.set_cur_block(succ_bb); } break; -- cgit v1.2.3