summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2017-01-07 08:36:55 +0800
committerJohn Hodge <tpg@mutabah.net>2017-01-07 08:36:55 +0800
commitbaf9ba776242192d4bf7eb81a58932a141605df0 (patch)
tree8fc7e13fe0d9ab21ad32fe1f97e07ade92c36d99
parent56ff9bf90bd78a16ec58cdda87cd00d2e4ec272f (diff)
downloadmrust-baf9ba776242192d4bf7eb81a58932a141605df0.tar.gz
Trans Enumerate - Constants
-rw-r--r--src/trans/enumerate.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/trans/enumerate.cpp b/src/trans/enumerate.cpp
index 479fc661..899b3b82 100644
--- a/src/trans/enumerate.cpp
+++ b/src/trans/enumerate.cpp
@@ -951,7 +951,14 @@ namespace {
best_impl = &impl;
bool is_spec = false;
TU_MATCHA( (trait_vi), (ve),
- (Constant, ),
+ (Constant,
+ auto it = impl.m_constants.find(e.item);
+ if( it == impl.m_constants.end() ) {
+ DEBUG("Constant " << e.item << " missing in trait " << e.trait << " for " << *e.type);
+ return false;
+ }
+ is_spec = it->second.is_specialisable;
+ ),
(Static,
auto it = impl.m_statics.find(e.item);
if( it == impl.m_statics.end() ) {
@@ -993,6 +1000,12 @@ namespace {
TU_MATCHA( (trait_vi), (ve),
(Constant,
+ auto it = impl.m_constants.find(e.item);
+ if( it != impl.m_constants.end() )
+ {
+ DEBUG("Found impl" << impl.m_params.fmt_args() << " " << impl.m_type);
+ return EntPtr { &it->second.data };
+ }
TODO(sp, "Associated constant - " << path);
),
(Static,