From c6c1702a3e2598245306f10dcc579001cd72b64e Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 1 Sep 2017 22:29:34 +0800 Subject: HIR Typecheck - (minor) Don't search for impls on a pure ivar --- src/hir_typeck/helpers.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp index 2ebdb44d..ebcf0d97 100644 --- a/src/hir_typeck/helpers.cpp +++ b/src/hir_typeck/helpers.cpp @@ -1089,6 +1089,14 @@ bool TraitResolution::find_trait_impls(const Span& sp, const auto& type = this->m_ivars.get_type(ty); TRACE_FUNCTION_F("trait = " << trait << params << ", type = " << type); + if( const auto* te = type.m_data.opt_Infer() ) + { + if( !te->is_lit() ) { + // NOTE: Can't hope to find an impl if we know nothing about the type. + return false; + } + } + const auto& lang_Sized = this->m_crate.get_lang_item_path(sp, "sized"); const auto& lang_Copy = this->m_crate.get_lang_item_path(sp, "copy"); const auto& lang_Unsize = this->m_crate.get_lang_item_path(sp, "unsize"); -- cgit v1.2.3