Commit 67fbb0434f

Andrew Kelley <superjoe30@gmail.com>
2018-11-11 18:48:55
ir: remove redundant casting code
1 parent ef5d7ce
Changed files (1)
src
src/ir.cpp
@@ -10421,25 +10421,6 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
         }
     }
 
-    // cast from *const [N]T to []const T
-    if (is_slice(wanted_type) &&
-        actual_type->id == ZigTypeIdPointer &&
-        actual_type->data.pointer.is_const &&
-        actual_type->data.pointer.child_type->id == ZigTypeIdArray)
-    {
-        ZigType *ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry;
-        assert(ptr_type->id == ZigTypeIdPointer);
-
-        ZigType *array_type = actual_type->data.pointer.child_type;
-
-        if ((ptr_type->data.pointer.is_const || array_type->data.array.len == 0) &&
-            types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, array_type->data.array.child_type,
-                source_node, false).id == ConstCastResultIdOk)
-        {
-            return ir_analyze_array_to_slice(ira, source_instr, value, wanted_type);
-        }
-    }
-
     // cast from [N]T to ?[]const T
     if (wanted_type->id == ZigTypeIdOptional &&
         is_slice(wanted_type->data.maybe.child_type) &&