summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-01-05 15:12:42 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-01-05 15:12:42 +0800
commitaa2f7a600ec4044785661a7b66b220420061a7bf (patch)
treeed7e83c2005d8913937415d9eb5a0c8e09429813
parent4ead75dea44e61502c8257161ff6b86fcc835adf (diff)
downloadmrust-aa2f7a600ec4044785661a7b66b220420061a7bf.tar.gz
Typecheck Expressions - Run EAT when checking auto traits
-rw-r--r--src/hir_typeck/helpers.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp
index 3ff39c63..5853a9dc 100644
--- a/src/hir_typeck/helpers.cpp
+++ b/src/hir_typeck/helpers.cpp
@@ -2575,7 +2575,7 @@ bool TraitResolution::find_trait_impls_crate(const Span& sp,
if( cmp != ::HIR::Compare::Unequal )
{
if( markings ) {
- ASSERT_BUG(sp, cmp == ::HIR::Compare::Equal, "Auto trait with no params returned a fuzzy match from destructure");
+ ASSERT_BUG(sp, cmp == ::HIR::Compare::Equal, "Auto trait with no params returned a fuzzy match from destructure - " << trait << " for " << type);
markings->auto_impls.insert( ::std::make_pair(trait, ::HIR::TraitMarkings::AutoMarking { {}, true }) );
}
return callback( ImplRef(&type, params_ptr, &null_assoc), cmp );
@@ -2641,7 +2641,7 @@ bool TraitResolution::find_trait_impls_crate(const Span& sp,
// HELPER: Get a possibily monomorphised version of the input type (stored in `tmp` if needed)
auto monomorph_get = [&](const auto& ty)->const ::HIR::TypeRef& {
if( monomorphise_type_needed(ty) ) {
- return (tmp = monomorphise_type_with(sp, ty, monomorph_cb));
+ return (tmp = this->expand_associated_types(sp, monomorphise_type_with(sp, ty, monomorph_cb)));
}
else {
return ty;
@@ -2710,9 +2710,11 @@ bool TraitResolution::find_trait_impls_crate(const Span& sp,
BUG(sp, "UfcsUnknown in typeck - " << type);
),
(UfcsKnown,
- // If unbound, use Fuzzy
- if(e.binding.is_Unbound())
+ // If unbound, use Fuzzy {
+ if(e.binding.is_Unbound()) {
+ DEBUG("- Unbound UfcsKnown, returning Fuzzy");
return ::HIR::Compare::Fuzzy;
+ }
// Otherwise, it's opaque. Check the bounds on the trait.
TODO(sp, "Check trait bounds for bound on " << type);
),