summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hir/type.cpp22
-rw-r--r--src/hir_typeck/helpers.cpp4
2 files changed, 25 insertions, 1 deletions
diff --git a/src/hir/type.cpp b/src/hir/type.cpp
index b6e930da..76154008 100644
--- a/src/hir/type.cpp
+++ b/src/hir/type.cpp
@@ -843,6 +843,17 @@ bool ::HIR::TypeRef::match_test_generics(const Span& sp, const ::HIR::TypeRef& x
return Compare::Unequal;
}
)
+ else TU_IFLET(::HIR::TypeRef::Data, right.m_data, Infer, le,
+ switch(le.ty_class)
+ {
+ case ::HIR::InferClass::None:
+ case ::HIR::InferClass::Diverge:
+ case ::HIR::InferClass::Integer:
+ return Compare::Fuzzy;
+ case ::HIR::InferClass::Float:
+ return Compare::Unequal;
+ }
+ )
else {
return Compare::Unequal;
}
@@ -857,6 +868,17 @@ bool ::HIR::TypeRef::match_test_generics(const Span& sp, const ::HIR::TypeRef& x
return Compare::Unequal;
}
)
+ else TU_IFLET(::HIR::TypeRef::Data, right.m_data, Infer, le,
+ switch(le.ty_class)
+ {
+ case ::HIR::InferClass::None:
+ case ::HIR::InferClass::Diverge:
+ case ::HIR::InferClass::Float:
+ return Compare::Fuzzy;
+ case ::HIR::InferClass::Integer:
+ return Compare::Unequal;
+ }
+ )
else {
return Compare::Unequal;
}
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp
index c0830810..02f06c6a 100644
--- a/src/hir_typeck/helpers.cpp
+++ b/src/hir_typeck/helpers.cpp
@@ -998,6 +998,8 @@ bool TraitResolution::find_trait_impls(const Span& sp,
return false;
}
)
+
+ // [T;N] -> [T] is handled down with array indexing
}
// Magical CoerceUnsized impls for various types
@@ -1102,7 +1104,7 @@ bool TraitResolution::find_trait_impls(const Span& sp,
// Continue
)
- // Magic index impls for Arrays
+ // Magic index and unsize impls for Arrays
// NOTE: The index impl for [T] is in libcore.
TU_IFLET(::HIR::TypeRef::Data, type.m_data, Array, e,
if( trait == trait_index || trait == trait_indexmut ) {