From 0ce263d0111d4f875a45f12c7d6fe0f049a11cd9 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 16 Sep 2016 12:11:38 +0800 Subject: HIR Typecheck Expr - Hackily assume placeholder type params impl any trait --- src/hir_typeck/helpers.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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) ) -- cgit v1.2.3