diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-08-23 07:26:14 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-08-23 07:26:14 +0800 |
commit | 0e436bf3b8c83c9c4c9976415ef21434df6c58ef (patch) | |
tree | bb0c06f02366b5bb374e961c7e780f5f0a6994d8 | |
parent | fe4720652a185c25bfa462c334bf3893888a4a2a (diff) | |
download | mrust-0e436bf3b8c83c9c4c9976415ef21434df6c58ef.tar.gz |
Typecheck Expressions - Fix case where a UFC isn't expanded before being used in coercion
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index ac4a5e86..af076092 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -5813,6 +5813,12 @@ namespace { // Literal infer, keep going (but remember how many times we dereferenced?) } + if( TU_TEST1(out_ty.m_data, Path, .binding.is_Unbound()) ) + { + DEBUG("Src derefed to unbound type (" << out_ty << "), return Unknown"); + return CoerceResult::Unknown; + } + types.push_back( out_ty.clone() ); // Types aren't equal @@ -6089,9 +6095,11 @@ namespace { // If the destination is an Unbound path, return Unknown if( TU_TEST1(dst.m_data, Path, .binding.is_Unbound()) ) { + DEBUG("Unbound destination"); return CoerceResult::Unknown; } + DEBUG("Reached end of check_unsize_tys, return Equality"); // TODO: Determine if this unsizing could ever happen. return CoerceResult::Equality; |