summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-16 12:11:38 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-16 12:11:38 +0800
commit0ce263d0111d4f875a45f12c7d6fe0f049a11cd9 (patch)
tree90d624f51ef779f43636d199d1f6b0123652044d
parent7b5a16e7a6868d7fc2e973247885df1d3ab6d799 (diff)
downloadmrust-0ce263d0111d4f875a45f12c7d6fe0f049a11cd9.tar.gz
HIR Typecheck Expr - Hackily assume placeholder type params impl any trait
-rw-r--r--src/hir_typeck/helpers.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp
index 8975c6ba..8f98f676 100644
--- a/src/hir_typeck/helpers.cpp
+++ b/src/hir_typeck/helpers.cpp
@@ -1170,6 +1170,16 @@ bool TraitResolution::find_trait_impls(const Span& sp,
return callback( ImplRef(&type, &e.m_trait.m_path.m_params, &e.m_trait.m_type_bounds), cmp );
}
)
+
+ // If the type in question is a magic placeholder, return a placeholder impl :)
+ TU_IFLET(::HIR::TypeRef::Data, type.m_data, Generic, e,
+ if( (e.binding >> 8) == 2 )
+ {
+ // TODO: This is probably going to break something in the future.
+ DEBUG("- Magic impl for placeholder type");
+ return callback( ImplRef(&type, &null_params, &null_assoc), ::HIR::Compare::Fuzzy );
+ }
+ )
// 1. Search generic params
if( find_trait_impls_bound(sp, trait, params, type, callback) )