diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 918f3cd7..085d5a79 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -5665,8 +5665,18 @@ namespace { { const auto& le = l.m_data.as_Borrow(); ASSERT_BUG(sp, r.m_data.is_Borrow() || r.m_data.is_Pointer(), "Coerce source for borrow isn't a borrow/pointert - " << r); + const auto re_borrow_type = r.m_data.is_Borrow() ? r.m_data.as_Borrow().type : r.m_data.as_Pointer().type; const auto& re_inner = r.m_data.is_Borrow() ? r.m_data.as_Borrow().inner : r.m_data.as_Pointer().inner; + if( le.type < re_borrow_type ) { + return DedupKeep::Left; + } + else if( le.type > re_borrow_type ) { + return DedupKeep::Right; + } + else { + } + // Dereference `*re.inner` until it isn't possible or it equals `*le.inner` // - Repeat going the other direction. if( H::type_derefs_from(sp, context, *le.inner, *re_inner) ) |