diff options
-rw-r--r-- | src/hir/type.cpp | 5 | ||||
-rw-r--r-- | src/hir_typeck/helpers.cpp | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/hir/type.cpp b/src/hir/type.cpp index f17613ea..c9f3fe85 100644 --- a/src/hir/type.cpp +++ b/src/hir/type.cpp @@ -575,6 +575,11 @@ bool ::HIR::TypeRef::match_test_generics(const Span& sp, const ::HIR::TypeRef& x DEBUG("- Fuzzy match due to opaque"); return Compare::Fuzzy; } + // HACK: If the RHS is a placeholder generic, allow it. + if( x.m_data.is_Generic() && (x.m_data.as_Generic().binding >> 8) == 2 ) { + DEBUG("- Fuzzy match due to placeholder"); + return Compare::Fuzzy; + } DEBUG("- Tag mismatch " << v << " and " << x); return Compare::Unequal; } diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp index bbde5163..b76b5e74 100644 --- a/src/hir_typeck/helpers.cpp +++ b/src/hir_typeck/helpers.cpp @@ -2208,6 +2208,17 @@ bool TraitResolution::find_trait_impls_crate(const Span& sp, } }; + //auto cb_res = [&](const auto& ty)->const auto& { + // if( ty.m_data.is_Infer() ) { + // return this->m_ivars.get_type(ty); + // } + // //else if( ty.m_data.is_Generic() && ty.m_data.as_Generic().binding >> 8 == 2 ) { + // // return ::HIR::TypeRef(); + // //} + // else { + // return ty; + // } + // }; // NOTE: If this type references an associated type, the match will incorrectly fail. // - HACK: match_test_generics_fuzz has been changed to return Fuzzy if there's a tag mismatch and the LHS is an Opaque path auto match = ::HIR::Compare::Equal; |