diff options
author | John Hodge <tpg@mutabah.net> | 2016-11-09 08:25:17 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-11-09 08:25:17 +0800 |
commit | 59e15029d0dcf10c2cea1d13ca8c681758b2384a (patch) | |
tree | 03e08fb25823a6bb22ad77f9329e693c4e330230 | |
parent | 679c2cfc60aa649852dfa59553a74eff91f9dc6f (diff) | |
download | mrust-59e15029d0dcf10c2cea1d13ca8c681758b2384a.tar.gz |
HIR Typecheck Expr - Treat an unbound type path as an ivar when searching for fields
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 4 | ||||
-rw-r--r-- | src/hir_typeck/helpers.cpp | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 1241f7b6..1f6dccdc 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -2647,6 +2647,10 @@ namespace { DEBUG("Hit ivar, returning early"); return ; } + if(ty.m_data.is_Path() && ty.m_data.as_Path().binding.is_Unbound()) { + DEBUG("Hit unbound path, returning early"); + return ; + } if( this->context.m_resolve.find_field(node.span(), ty, field_name, out_type) ) { this->context.equate_types(node.span(), node.m_res_type, out_type); break; diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp index b7c995e4..6948e60c 100644 --- a/src/hir_typeck/helpers.cpp +++ b/src/hir_typeck/helpers.cpp @@ -3294,6 +3294,9 @@ unsigned int TraitResolution::autoderef_find_field(const Span& sp, const ::HIR:: if( ty.m_data.is_Infer() ) { return ~0u; } + if(ty.m_data.is_Path() && ty.m_data.as_Path().binding.is_Unbound()) { + return ~0u; + } if( this->find_field(sp, ty, field_name, field_type) ) { return deref_count; |