summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/expr_cs.cpp19
-rw-r--r--src/hir_typeck/helpers.cpp6
2 files changed, 20 insertions, 5 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 1a0dc0e2..63383aa5 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -4422,7 +4422,7 @@ namespace {
const auto& out_ty = context.m_ivars.get_type(*out_ty_p);
count += 1;
- if( out_ty.m_data.is_Infer() && out_ty.m_data.as_Infer().ty_class == ::HIR::InferClass::None ) {
+ if( out_ty.m_data.is_Infer() && !out_ty.m_data.as_Infer().is_lit() ) {
// Hit a _, so can't keep going
break;
}
@@ -5325,11 +5325,22 @@ namespace {
DEBUG("> Magic params present, wait");
return false;
}
-
+ const auto& impl_ty = context.m_ivars.get_type(v.impl_ty);
+ if( TU_TEST1(impl_ty.m_data, Path, .binding.is_Unbound()) )
+ {
+ DEBUG("Unbound UfcsKnown, waiting");
+ return false;
+ }
+ if( TU_TEST1(impl_ty.m_data, Infer, .is_lit() == false) )
+ {
+ DEBUG("Unbounded ivar, waiting - TODO: Add possibility " << impl_ty << " == " << possible_impl_ty);
+ return false;
+ }
// Only one possible impl
- if( v.name != "" ) {
+ if( v.name != "" )
+ {
// If the output type is just < v.impl_ty as v.trait >::v.name, return false
- if( output_type.m_data.is_Path() && output_type.m_data.as_Path().path.m_data.is_UfcsKnown() )
+ if( TU_TEST1(output_type.m_data, Path, .path.m_data.is_UfcsKnown()) )
{
const auto& pe = output_type.m_data.as_Path().path.m_data.as_UfcsKnown();
if( *pe.type == v.impl_ty && pe.trait.m_path == v.trait && pe.trait.m_params == v.params && pe.item == v.name )
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp
index 660127fc..d340514b 100644
--- a/src/hir_typeck/helpers.cpp
+++ b/src/hir_typeck/helpers.cpp
@@ -1091,6 +1091,7 @@ bool TraitResolution::find_trait_impls(const Span& sp,
const auto& type = this->m_ivars.get_type(ty);
TRACE_FUNCTION_F("trait = " << trait << params << ", type = " << type);
+#if 0
if( const auto* te = type.m_data.opt_Infer() )
{
if( !te->is_lit() ) {
@@ -1098,6 +1099,7 @@ bool TraitResolution::find_trait_impls(const Span& sp,
return false;
}
}
+#endif
const auto& lang_Sized = this->m_crate.get_lang_item_path(sp, "sized");
const auto& lang_Copy = this->m_crate.get_lang_item_path(sp, "copy");
@@ -1131,7 +1133,7 @@ bool TraitResolution::find_trait_impls(const Span& sp,
// Magic impls of the Fn* traits for closure types
TU_IFLET(::HIR::TypeRef::Data, type.m_data, Closure, e,
- DEBUG("Closure, "<< trait <<" " << trait_fn << " " << trait_fn_mut << " " << trait_fn_once);
+ DEBUG("Closure, " << trait << " ?= " << trait_fn << " " << trait_fn_mut << " " << trait_fn_once);
if( trait == trait_fn || trait == trait_fn_mut || trait == trait_fn_once ) {
if( params.m_types.size() != 1 )
BUG(sp, "Fn* traits require a single tuple argument");
@@ -2202,10 +2204,12 @@ bool TraitResolution::find_trait_impls_bound(const Span& sp, const ::HIR::Simple
)
)
+#if 0
if( m_ivars.get_type(type).m_data.is_Infer() )
return false;
if( TU_TEST1(m_ivars.get_type(type).m_data, Path, .binding.is_Unbound()) )
return false;
+#endif
// TODO: A bound can imply something via its associated types. How deep can this go?
// E.g. `T: IntoIterator<Item=&u8>` implies `<T as IntoIterator>::IntoIter : Iterator<Item=&u8>`