summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mir/from_hir.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp
index e5e11404..95c664b2 100644
--- a/src/mir/from_hir.cpp
+++ b/src/mir/from_hir.cpp
@@ -976,11 +976,16 @@ namespace {
{
TRACE_FUNCTION_F("_Unsize");
this->visit_node_ptr(node.m_value);
- auto ptr_lval = m_builder.get_result_in_lvalue(node.m_value->span(), node.m_value->m_res_type);
const auto& ty_out = node.m_res_type;
const auto& ty_in = node.m_value->m_res_type;
+ if( ty_out == ty_in ) {
+ return ;
+ }
+
+ auto ptr_lval = m_builder.get_result_in_lvalue(node.m_value->span(), node.m_value->m_res_type);
+
if( ty_out.m_data.is_Borrow() && ty_in.m_data.is_Borrow() )
{
const auto& oe = ty_out.m_data.as_Borrow();