diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-09-01 22:29:34 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-09-01 22:29:34 +0800 |
commit | c6c1702a3e2598245306f10dcc579001cd72b64e (patch) | |
tree | 68b7dad49545a818a76bd2ebf78adb7bf7e12bae /src | |
parent | 07b6236f95ad270af5bc9cc749e230c7926fb57c (diff) | |
download | mrust-c6c1702a3e2598245306f10dcc579001cd72b64e.tar.gz |
HIR Typecheck - (minor) Don't search for impls on a pure ivar
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/helpers.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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"); |