summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-10-05 09:58:50 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-10-05 09:58:50 +0800
commit08cba23ec538ec2857bcd79bb2f7bcb3e8048e1c (patch)
treedfe99f554c5c9c1d6940d33baa35a8ba09b383a7
parent8c6cfce9aa2fa8293c30c101b87c5298087833e5 (diff)
downloadmrust-08cba23ec538ec2857bcd79bb2f7bcb3e8048e1c.tar.gz
HIR Typecheck - Handle unbound UFCS types properly in coercions
-rw-r--r--src/hir_typeck/expr_cs.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index e394e9b2..56525762 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -6279,6 +6279,11 @@ namespace {
}
}
+ // If either side is an unbound UFCS, can't know yet
+ if( TU_TEST1(dst.m_data, Path, .binding.is_Unbound()) || TU_TEST1(src.m_data, Path, .binding.is_Unbound()) )
+ {
+ return CoerceResult::Unknown;
+ }
// Any other type, check for pointer
// - If not a pointer, return Equality
@@ -7150,6 +7155,7 @@ namespace {
{
possible_tys.push_back(PossibleType { false, false, &new_ty });
}
+ DEBUG("possible_tys = " << possible_tys);
// If exactly the same type is both a source and destination, equate.
// - This is always correct, even if one of the types is an ivar (you can't go A -> B -> A with a coercion)
@@ -7175,7 +7181,6 @@ namespace {
}
}
}
- DEBUG("possible_tys = " << possible_tys);
if( ty_l.m_data.as_Infer().ty_class == ::HIR::InferClass::Diverge )
{