| ... | @@ -16033,7 +16033,6 @@ fn coerce( | ... | @@ -16033,7 +16033,6 @@ fn coerce( |
| 16033 | }, | 16033 | }, |
| 16034 | .Pointer => p: { | 16034 | .Pointer => p: { |
| 16035 | const inst_info = inst_ty.ptrInfo().data; | 16035 | const inst_info = inst_ty.ptrInfo().data; |
| 16036 | if (inst_info.size == .Slice) break :p; | | |
| 16037 | switch (try sema.coerceInMemoryAllowed( | 16036 | switch (try sema.coerceInMemoryAllowed( |
| 16038 | block, | 16037 | block, |
| 16039 | dest_info.pointee_type, | 16038 | dest_info.pointee_type, |
| ... | @@ -16046,6 +16045,14 @@ fn coerce( | ... | @@ -16046,6 +16045,14 @@ fn coerce( |
| 16046 | .ok => {}, | 16045 | .ok => {}, |
| 16047 | .no_match => break :p, | 16046 | .no_match => break :p, |
| 16048 | } | 16047 | } |
| | 16048 | if (inst_info.size == .Slice) { |
| | 16049 | if (dest_info.sentinel == null or inst_info.sentinel == null or |
| | 16050 | !dest_info.sentinel.?.eql(inst_info.sentinel.?, dest_info.pointee_type)) |
| | 16051 | break :p; |
| | 16052 | |
| | 16053 | const slice_ptr = try sema.analyzeSlicePtr(block, inst_src, inst, inst_ty); |
| | 16054 | return sema.coerceCompatiblePtrs(block, dest_ty, slice_ptr, inst_src); |
| | 16055 | } |
| 16049 | return sema.coerceCompatiblePtrs(block, dest_ty, inst, inst_src); | 16056 | return sema.coerceCompatiblePtrs(block, dest_ty, inst, inst_src); |
| 16050 | }, | 16057 | }, |
| 16051 | else => {}, | 16058 | else => {}, |
| ... | @@ -16089,7 +16096,30 @@ fn coerce( | ... | @@ -16089,7 +16096,30 @@ fn coerce( |
| 16089 | return sema.coerceTupleToSlicePtrs(block, dest_ty, dest_ty_src, inst, inst_src); | 16096 | return sema.coerceTupleToSlicePtrs(block, dest_ty, dest_ty_src, inst, inst_src); |
| 16090 | } | 16097 | } |
| 16091 | }, | 16098 | }, |
| 16092 | .Many => {}, | 16099 | .Many => p: { |
| | 16100 | const inst_info = inst_ty.ptrInfo().data; |
| | 16101 | if (inst_info.size != .Slice) break :p; |
| | 16102 | |
| | 16103 | switch (try sema.coerceInMemoryAllowed( |
| | 16104 | block, |
| | 16105 | dest_info.pointee_type, |
| | 16106 | inst_info.pointee_type, |
| | 16107 | dest_info.mutable, |
| | 16108 | target, |
| | 16109 | dest_ty_src, |
| | 16110 | inst_src, |
| | 16111 | )) { |
| | 16112 | .ok => {}, |
| | 16113 | .no_match => break :p, |
| | 16114 | } |
| | 16115 | |
| | 16116 | if (dest_info.sentinel == null or inst_info.sentinel == null or |
| | 16117 | !dest_info.sentinel.?.eql(inst_info.sentinel.?, dest_info.pointee_type)) |
| | 16118 | break :p; |
| | 16119 | |
| | 16120 | const slice_ptr = try sema.analyzeSlicePtr(block, inst_src, inst, inst_ty); |
| | 16121 | return sema.coerceCompatiblePtrs(block, dest_ty, slice_ptr, inst_src); |
| | 16122 | }, |
| 16093 | } | 16123 | } |
| 16094 | | 16124 | |
| 16095 | // This will give an extra hint on top of what the bottom of this func would provide. | 16125 | // This will give an extra hint on top of what the bottom of this func would provide. |