| ... | @@ -23014,9 +23014,37 @@ fn coerceExtra( | ... | @@ -23014,9 +23014,37 @@ fn coerceExtra( |
| 23014 | const dest_is_mut = dest_info.mutable; | 23014 | const dest_is_mut = dest_info.mutable; |
| 23015 | | 23015 | |
| 23016 | const dst_elem_type = dest_info.pointee_type; | 23016 | const dst_elem_type = dest_info.pointee_type; |
| 23017 | switch (try sema.coerceInMemoryAllowed(block, dst_elem_type, array_elem_type, dest_is_mut, target, dest_ty_src, inst_src)) { | 23017 | const elem_res = try sema.coerceInMemoryAllowed(block, dst_elem_type, array_elem_type, dest_is_mut, target, dest_ty_src, inst_src); |
| | 23018 | switch (elem_res) { |
| 23018 | .ok => {}, | 23019 | .ok => {}, |
| 23019 | else => break :src_array_ptr, | 23020 | else => { |
| | 23021 | in_memory_result = .{ .ptr_child = .{ |
| | 23022 | .child = try elem_res.dupe(sema.arena), |
| | 23023 | .actual = array_elem_type, |
| | 23024 | .wanted = dst_elem_type, |
| | 23025 | } }; |
| | 23026 | break :src_array_ptr; |
| | 23027 | }, |
| | 23028 | } |
| | 23029 | |
| | 23030 | if (dest_info.sentinel) |dest_sent| { |
| | 23031 | if (array_ty.sentinel()) |inst_sent| { |
| | 23032 | if (!dest_sent.eql(inst_sent, dst_elem_type, sema.mod)) { |
| | 23033 | in_memory_result = .{ .ptr_sentinel = .{ |
| | 23034 | .actual = inst_sent, |
| | 23035 | .wanted = dest_sent, |
| | 23036 | .ty = dst_elem_type, |
| | 23037 | } }; |
| | 23038 | break :src_array_ptr; |
| | 23039 | } |
| | 23040 | } else { |
| | 23041 | in_memory_result = .{ .ptr_sentinel = .{ |
| | 23042 | .actual = Value.initTag(.unreachable_value), |
| | 23043 | .wanted = dest_sent, |
| | 23044 | .ty = dst_elem_type, |
| | 23045 | } }; |
| | 23046 | break :src_array_ptr; |
| | 23047 | } |
| 23020 | } | 23048 | } |
| 23021 | | 23049 | |
| 23022 | switch (dest_info.size) { | 23050 | switch (dest_info.size) { |
| ... | @@ -23030,17 +23058,7 @@ fn coerceExtra( | ... | @@ -23030,17 +23058,7 @@ fn coerceExtra( |
| 23030 | }, | 23058 | }, |
| 23031 | .Many => { | 23059 | .Many => { |
| 23032 | // *[N]T to [*]T | 23060 | // *[N]T to [*]T |
| 23033 | // *[N:s]T to [*:s]T | 23061 | return sema.coerceCompatiblePtrs(block, dest_ty, inst, inst_src); |
| 23034 | // *[N:s]T to [*]T | | |
| 23035 | if (dest_info.sentinel) |dst_sentinel| { | | |
| 23036 | if (array_ty.sentinel()) |src_sentinel| { | | |
| 23037 | if (src_sentinel.eql(dst_sentinel, dst_elem_type, sema.mod)) { | | |
| 23038 | return sema.coerceCompatiblePtrs(block, dest_ty, inst, inst_src); | | |
| 23039 | } | | |
| 23040 | } | | |
| 23041 | } else { | | |
| 23042 | return sema.coerceCompatiblePtrs(block, dest_ty, inst, inst_src); | | |
| 23043 | } | | |
| 23044 | }, | 23062 | }, |
| 23045 | .One => {}, | 23063 | .One => {}, |
| 23046 | } | 23064 | } |