summaryrefslogtreecommitdiff
path: root/src/hir
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-04-24 12:21:20 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-04-24 12:21:20 +0800
commit444f4915d27837ac3d6515f081519f4fe2e07eed (patch)
treed8e481fb43b805c86b8cd423104b65f6add00f8b /src/hir
parent17ca4b82d5c8af93e95e04a549153656e494cdae (diff)
downloadmrust-444f4915d27837ac3d6515f081519f4fe2e07eed.tar.gz
Typecheck Expressions - Add an unsize target instead of hard equality in match ergonoics
Diffstat (limited to 'src/hir')
-rw-r--r--src/hir/hir_ops.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/hir/hir_ops.cpp b/src/hir/hir_ops.cpp
index 4b35a0f0..b09dbdf7 100644
--- a/src/hir/hir_ops.cpp
+++ b/src/hir/hir_ops.cpp
@@ -215,9 +215,9 @@ namespace {
namespace {
bool is_unbounded_infer(const ::HIR::TypeRef& type) {
- TU_IFLET( ::HIR::TypeRef::Data, type.m_data, Infer, e,
- return e.ty_class == ::HIR::InferClass::None || e.ty_class == ::HIR::InferClass::Diverge;
- )
+ if( const auto* e = type.m_data.opt_Infer() ) {
+ return e->ty_class == ::HIR::InferClass::None || e->ty_class == ::HIR::InferClass::Diverge;
+ }
else {
return false;
}
@@ -229,6 +229,8 @@ bool ::HIR::TraitImpl::matches_type(const ::HIR::TypeRef& type, ::HIR::t_cb_reso
// NOTE: Don't return any impls when the type is an unbouned ivar. Wouldn't be able to pick anything anyway
// TODO: For `Unbound`, it could be valid, if the target is a generic.
// - Pure infer could also be useful (for knowing if there's any other potential impls)
+
+ // TODO: Allow unbounded types iff there's some non-unbounded parameters?
if( is_unbounded_infer(type) || TU_TEST1(type.m_data, Path, .binding.is_Unbound()) ) {
return false;
}