summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-06 13:18:38 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-06 13:18:38 +0800
commite3f224aa2bc05460faf68c8249c2d4c5ef93da61 (patch)
treea1d635ce96a1988119049083065941693b051505 /src
parent256e89db445be8567bea0bab33bdeade9e25c7a8 (diff)
downloadmrust-e3f224aa2bc05460faf68c8249c2d4c5ef93da61.tar.gz
HIR Typecheck Static - Support extraction of associated type from TraitOBject bound
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/static.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/hir_typeck/static.cpp b/src/hir_typeck/static.cpp
index cb01e78d..c8afdebf 100644
--- a/src/hir_typeck/static.cpp
+++ b/src/hir_typeck/static.cpp
@@ -485,6 +485,25 @@ void StaticTraitResolve::expand_associated_types__UfcsKnown(const Span& sp, ::HI
//}
)
+ // If it's a TraitObject, then maybe we're asking for a bound
+ TU_IFLET(::HIR::TypeRef::Data, e2.type->m_data, TraitObject, te,
+ const auto& data_trait = te.m_trait.m_path;
+ if( e2.trait.m_path == data_trait.m_path ) {
+ if( e2.trait.m_params == data_trait.m_params )
+ {
+ auto it = te.m_trait.m_type_bounds.find( e2.item );
+ if( it == te.m_trait.m_type_bounds.end() ) {
+ // TODO: Mark as opaque and return.
+ // - Why opaque? It's not bounded, don't even bother
+ TODO(sp, "Handle unconstrained associate type " << e2.item << " from " << *e2.type);
+ }
+
+ input = it->second.clone();
+ return ;
+ }
+ }
+ )
+
// 1. Bounds
bool rv;
bool assume_opaque = true;