| ... | ... | @@ -10421,25 +10421,6 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10421 | 10421 | } |
| 10422 | 10422 | } |
| 10423 | 10423 | |
| 10424 | | // cast from *const [N]T to []const T |
| 10425 | | if (is_slice(wanted_type) && |
| 10426 | | actual_type->id == ZigTypeIdPointer && |
| 10427 | | actual_type->data.pointer.is_const && |
| 10428 | | actual_type->data.pointer.child_type->id == ZigTypeIdArray) |
| 10429 | | { |
| 10430 | | ZigType *ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry; |
| 10431 | | assert(ptr_type->id == ZigTypeIdPointer); |
| 10432 | | |
| 10433 | | ZigType *array_type = actual_type->data.pointer.child_type; |
| 10434 | | |
| 10435 | | if ((ptr_type->data.pointer.is_const || array_type->data.array.len == 0) && |
| 10436 | | types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, array_type->data.array.child_type, |
| 10437 | | source_node, false).id == ConstCastResultIdOk) |
| 10438 | | { |
| 10439 | | return ir_analyze_array_to_slice(ira, source_instr, value, wanted_type); |
| 10440 | | } |
| 10441 | | } |
| 10442 | | |
| 10443 | 10424 | // cast from [N]T to ?[]const T |
| 10444 | 10425 | if (wanted_type->id == ZigTypeIdOptional && |
| 10445 | 10426 | is_slice(wanted_type->data.maybe.child_type) && |