diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 1 | ||||
-rw-r--r-- | src/hir_typeck/helpers.cpp | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index ecaae208..eb0ccbdb 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -2867,6 +2867,7 @@ namespace { if( possible_methods.size() != 1 && possible_methods.front().second.m_data.is_UfcsKnown() ) { DEBUG("- Multiple options, deferring"); + // TODO: If the type is fully known, then this is an error. return; } auto& ad_borrow = possible_methods.front().first; diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp index 663818e2..c2e95fd6 100644 --- a/src/hir_typeck/helpers.cpp +++ b/src/hir_typeck/helpers.cpp @@ -4021,6 +4021,12 @@ bool TraitResolution::find_method(const Span& sp, rv = true; } } + + // If the method was found on the trait object, prefer that over all others. + if( !possibilities.empty() ) + { + return rv; + } } // 3. Mutually exclusive searches |