| ... | @@ -25093,6 +25093,13 @@ fn coerceExtra( | ... | @@ -25093,6 +25093,13 @@ fn coerceExtra( |
| 25093 | } }; | 25093 | } }; |
| 25094 | break :pointer; | 25094 | break :pointer; |
| 25095 | } | 25095 | } |
| | 25096 | if (inst_ty.isSlice()) { |
| | 25097 | in_memory_result = .{ .slice_to_anyopaque = .{ |
| | 25098 | .actual = inst_ty, |
| | 25099 | .wanted = dest_ty, |
| | 25100 | } }; |
| | 25101 | break :pointer; |
| | 25102 | } |
| 25096 | return sema.coerceCompatiblePtrs(block, dest_ty, inst, inst_src); | 25103 | return sema.coerceCompatiblePtrs(block, dest_ty, inst, inst_src); |
| 25097 | } | 25104 | } |
| 25098 | | 25105 | |
| ... | @@ -25603,6 +25610,7 @@ const InMemoryCoercionResult = union(enum) { | ... | @@ -25603,6 +25610,7 @@ const InMemoryCoercionResult = union(enum) { |
| 25603 | ptr_bit_range: BitRange, | 25610 | ptr_bit_range: BitRange, |
| 25604 | ptr_alignment: IntPair, | 25611 | ptr_alignment: IntPair, |
| 25605 | double_ptr_to_anyopaque: Pair, | 25612 | double_ptr_to_anyopaque: Pair, |
| | 25613 | slice_to_anyopaque: Pair, |
| 25606 | | 25614 | |
| 25607 | const Pair = struct { | 25615 | const Pair = struct { |
| 25608 | actual: Type, | 25616 | actual: Type, |
| ... | @@ -25901,6 +25909,13 @@ const InMemoryCoercionResult = union(enum) { | ... | @@ -25901,6 +25909,13 @@ const InMemoryCoercionResult = union(enum) { |
| 25901 | }); | 25909 | }); |
| 25902 | break; | 25910 | break; |
| 25903 | }, | 25911 | }, |
| | 25912 | .slice_to_anyopaque => |pair| { |
| | 25913 | try sema.errNote(block, src, msg, "cannot implicitly cast slice '{}' to anyopaque pointer '{}'", .{ |
| | 25914 | pair.actual.fmt(sema.mod), pair.wanted.fmt(sema.mod), |
| | 25915 | }); |
| | 25916 | try sema.errNote(block, src, msg, "consider using '.ptr'", .{}); |
| | 25917 | break; |
| | 25918 | }, |
| 25904 | }; | 25919 | }; |
| 25905 | } | 25920 | } |
| 25906 | }; | 25921 | }; |