summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/expr_cs.cpp6
-rw-r--r--src/hir_typeck/helpers.cpp18
2 files changed, 23 insertions, 1 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index c0fb935d..8011e0a8 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -4734,7 +4734,11 @@ namespace {
}
else
{
- ERROR(sp, E0000, "Failed to find an impl of " << v.trait << context.m_ivars.fmt(v.params) << " for " << context.m_ivars.fmt_type(v.impl_ty));
+ if( v.name == "" )
+ ERROR(sp, E0000, "Failed to find an impl of " << v.trait << context.m_ivars.fmt(v.params) << " for " << context.m_ivars.fmt_type(v.impl_ty));
+ else
+ ERROR(sp, E0000, "Failed to find an impl of " << v.trait << context.m_ivars.fmt(v.params) << " for " << context.m_ivars.fmt_type(v.impl_ty)
+ << " with " << v.name << " = " << context.m_ivars.fmt_type(v.left_ty));
}
}
else if( count == 1 ) {
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp
index d739b5d2..8406d1db 100644
--- a/src/hir_typeck/helpers.cpp
+++ b/src/hir_typeck/helpers.cpp
@@ -1602,6 +1602,24 @@ void TraitResolution::expand_associated_types_inplace__UfcsKnown(const Span& sp,
}
)
+ TU_IFLET(::HIR::TypeRef::Data, pe.type->m_data, Function, te,
+ if( te.m_abi == ABI_RUST && !te.is_unsafe )
+ {
+ const auto trait_fn = this->m_crate.get_lang_item_path(sp, "fn");
+ const auto trait_fn_mut = this->m_crate.get_lang_item_path(sp, "fn_mut");
+ const auto trait_fn_once = this->m_crate.get_lang_item_path(sp, "fn_once");
+ if( pe.trait.m_path == trait_fn || pe.trait.m_path == trait_fn_mut || pe.trait.m_path == trait_fn_once ) {
+ if( pe.item == "Output" ) {
+ input = te.m_rettype->clone();
+ return ;
+ }
+ else {
+ ERROR(sp, E0000, "No associated type " << pe.item << " for trait " << pe.trait);
+ }
+ }
+ }
+ )
+
// If it's a TraitObject, then maybe we're asking for a bound
TU_IFLET(::HIR::TypeRef::Data, pe.type->m_data, TraitObject, te,
const auto& data_trait = te.m_trait.m_path;