summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-08-31 16:27:41 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-08-31 16:27:41 +0800
commitf541aed0641f93432b81a13f872edf1edf5e63e3 (patch)
tree0247978d9380c408a3d3c00054d76d6b54da0068
parentd545aa5cdfb6813c0b4f77a6b66e391a3d887fb4 (diff)
downloadmrust-f541aed0641f93432b81a13f872edf1edf5e63e3.tar.gz
HIR Resolve UFCS - Fix assertion failure (allow false return)
-rw-r--r--src/hir_conv/resolve_ufcs.cpp6
-rw-r--r--src/hir_typeck/static.cpp5
2 files changed, 8 insertions, 3 deletions
diff --git a/src/hir_conv/resolve_ufcs.cpp b/src/hir_conv/resolve_ufcs.cpp
index 587c54dd..f57ad2c2 100644
--- a/src/hir_conv/resolve_ufcs.cpp
+++ b/src/hir_conv/resolve_ufcs.cpp
@@ -106,6 +106,7 @@ namespace {
void visit_expr(::HIR::ExprPtr& expr) override
{
+#if 1
struct ExprVisitor:
public ::HIR::ExprVisitorDef
{
@@ -187,6 +188,7 @@ namespace {
(*expr).visit(v);
m_in_expr = false;
}
+#endif
}
bool locate_trait_item_in_bounds(::HIR::Visitor::PathContext pc, const ::HIR::TypeRef& tr, const ::HIR::GenericParams& params, ::HIR::Path::Data& pd) {
@@ -319,12 +321,13 @@ namespace {
{
auto& e = pd.as_UfcsUnknown();
const auto& type = *e.type;
+ TRACE_FUNCTION_F("trait_path=" << trait_path << ", p=<" << type << " as _>::" << e.item);
// TODO: This is VERY arbitary and possibly nowhere near what rustc does.
this->m_resolve.find_impl(sp, trait_path.m_path, nullptr, type, [&](const auto& impl, bool fuzzy)->bool{
auto pp = impl.get_trait_params();
// Replace all placeholder parameters (group 2) with ivars (empty types)
- pp = monomorphise_path_params_with(sp, pp, [&](const auto& gt)->const ::HIR::TypeRef& {
+ pp = monomorphise_path_params_with(sp, pp, [](const auto& gt)->const ::HIR::TypeRef& {
const auto& ge = gt.m_data.as_Generic();
if( (ge.binding >> 8) == 2 ) {
static ::HIR::TypeRef empty_type;
@@ -584,6 +587,7 @@ namespace {
}
void visit_pattern_Value(const Span& sp, const ::HIR::Pattern& pat, ::HIR::Pattern::Value& val)
{
+ TRACE_FUNCTION_F("pat=" << pat << ", val=" << val);
TU_IFLET( ::HIR::Pattern::Value, val, Named, ve,
TRACE_FUNCTION_F(ve.path);
TU_MATCH( ::HIR::Path::Data, (ve.path.m_data), (pe),
diff --git a/src/hir_typeck/static.cpp b/src/hir_typeck/static.cpp
index e33f29e6..57a93dc3 100644
--- a/src/hir_typeck/static.cpp
+++ b/src/hir_typeck/static.cpp
@@ -636,8 +636,9 @@ bool StaticTraitResolve::find_impl__check_crate_raw(
//auto cmp = have .match_test_generics_fuzz(sp, exp, cb_ident, cb_match);
auto cmp = exp .match_test_generics_fuzz(sp, have, cb_ident, cb_match);
- ASSERT_BUG(sp, cmp != ::HIR::Compare::Unequal, "Assoc ty " << aty_name << " mismatch, " << have << " != des " << exp);
- return true;
+ if( cmp == ::HIR::Compare::Unequal )
+ DEBUG("Assoc ty " << aty_name << " mismatch, " << have << " != des " << exp);
+ return cmp != ::HIR::Compare::Unequal;
});
}
if( !rv ) {