summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--src/hir_typeck/expr_cs.cpp31
2 files changed, 24 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index cec1790b..67f25c5d 100644
--- a/Makefile
+++ b/Makefile
@@ -396,16 +396,13 @@ DISABLED_TESTS += run-pass/issue-7784 # PartialEq impl and deref
DISABLED_TESTS += run-pass/traits-issue-26339 # ^
DISABLED_TESTS += run-pass/builtin-superkinds-self-type # ^
DISABLED_TESTS += run-pass/intrinsic-move-val # ^
-DISABLED_TESTS += run-pass/issue-9951 # Trait impled for i32
-DISABLED_TESTS += run-pass/trait-default-method-xc # ^
-DISABLED_TESTS += run-pass/trait-impl # ^
+DISABLED_TESTS += run-pass/trait-default-method-xc # Trait impled for i32
DISABLED_TESTS += run-pass/issue-11205 # ^
DISABLED_TESTS += run-pass/mir_coercions # Coercion to unsafe fn
DISABLED_TESTS += run-pass/typeck-fn-to-unsafe-fn-ptr # ^
DISABLED_TESTS += run-pass/unsafe-coercion # ^
DISABLED_TESTS += run-pass/mir_misc_casts # Cast fn to *const isize
DISABLED_TESTS += run-pass/never-result # ! not correctly unifiying
-DISABLED_TESTS += run-pass/reachable-unnameable-items # assert Struct::is_Named()
DISABLED_TESTS += run-pass/self-impl # Unable to infer
DISABLED_TESTS += run-pass/trait-copy-guessing # ^
DISABLED_TESTS += run-pass/issue-20575 # ^
@@ -711,6 +708,7 @@ DISABLED_TESTS += run-pass/unwind-resource
DISABLED_TESTS += run-pass/unwind-unique
DISABLED_TESTS += run-pass/vector-sort-panic-safe
DISABLED_TESTS += run-pass/dynamic-drop
+DISABLED_TESTS += run-pass/reachable-unnameable-items
# - Misc
DISABLED_TESTS += run-pass/issue-16671 # Blocks forever
DISABLED_TESTS += run-pass/issue-13027 # Infinite loop (match?)
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index 5c69e20b..ac2cf511 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -4214,16 +4214,29 @@ namespace {
// If the source is '_', we can't know yet
TU_IFLET(::HIR::TypeRef::Data, ty_src.m_data, Infer, r_e,
- // TODO: If the source is a literal, and the destination isn't a TraitObject, equate.
- // - Except if it's known to be a primitive
- //if( r_e.ty_class != ::HIR::InferClass::None ) {
- // context.equate_types(sp, ty_dst, ty_src);
- // return true;
- //}
- context.possible_equate_type_unsize_to(r_e.index, ty_dst);
- DEBUG("- Infer, add possibility");
- return false;
+ // No avaliable information, add a possible unsize
+ if( r_e.ty_class == ::HIR::InferClass::None || r_e.ty_class == ::HIR::InferClass::Diverge )
+ {
+ // Possibility
+ context.possible_equate_type_unsize_to(r_e.index, ty_dst);
+ DEBUG("- Infer, add possibility");
+ return false;
+ }
+ // Destination is infer, fall through to next TU_IFLET
+ else if( ty_dst.m_data.is_Infer() )
+ {
+ }
+ // Destination is a TraitObject, fall through to doing an impl search
+ else if( ty_dst.m_data.is_TraitObject() )
+ {
+ }
+ // Otherwise, they have to be equal
+ else
+ {
+ context.equate_types(sp, ty_dst, ty_src);
+ return true;
+ }
)
TU_IFLET(::HIR::TypeRef::Data, ty_dst.m_data, Infer, l_e,