diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-09-08 03:59:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-08 03:59:38 -0700 |
| commit | 05cff8a558fda0e974ea7d00f26f8f4ff6e1195f (patch) | |
| tree | c99a4d2366532e5937ca7f944eb0008601a4edce /src/Sema.zig | |
| parent | 426d65d700012b27ffa652258554032f171ad77d (diff) | |
| parent | 7666d5fc2653023670f6e61b6d19b0ba15750d67 (diff) | |
| download | zig-05cff8a558fda0e974ea7d00f26f8f4ff6e1195f.tar.gz zig-05cff8a558fda0e974ea7d00f26f8f4ff6e1195f.zip | |
Merge pull request #25186 from ziglang/vector-memory-coercion
frontend: vectors and arrays no longer support in-memory coercion
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 587c6b2d70..51b93fb308 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -29649,50 +29649,6 @@ pub fn coerceInMemoryAllowed( return .ok; } - // Arrays <-> Vectors - if ((dest_tag == .vector and src_tag == .array) or - (dest_tag == .array and src_tag == .vector)) - { - const dest_len = dest_ty.arrayLen(zcu); - const src_len = src_ty.arrayLen(zcu); - if (dest_len != src_len) { - return .{ .array_len = .{ - .actual = src_len, - .wanted = dest_len, - } }; - } - - const dest_elem_ty = dest_ty.childType(zcu); - const src_elem_ty = src_ty.childType(zcu); - const child = try sema.coerceInMemoryAllowed(block, dest_elem_ty, src_elem_ty, dest_is_mut, target, dest_src, src_src, null); - if (child != .ok) { - return .{ .array_elem = .{ - .child = try child.dupe(sema.arena), - .actual = src_elem_ty, - .wanted = dest_elem_ty, - } }; - } - - if (dest_tag == .array) { - const dest_info = dest_ty.arrayInfo(zcu); - if (dest_info.sentinel != null) { - return .{ .array_sentinel = .{ - .actual = Value.@"unreachable", - .wanted = dest_info.sentinel.?, - .ty = dest_info.elem_type, - } }; - } - } - - // The memory layout of @Vector(N, iM) is the same as the integer type i(N*M), - // that is to say, the padding bits are not in the same place as the array [N]iM. - // If there's no padding, the bitcast is possible. - const elem_bit_size = dest_elem_ty.bitSize(zcu); - const elem_abi_byte_size = dest_elem_ty.abiSize(zcu); - if (elem_abi_byte_size * 8 == elem_bit_size) - return .ok; - } - // Optionals if (dest_tag == .optional and src_tag == .optional) { if ((maybe_dest_ptr_ty != null) != (maybe_src_ptr_ty != null)) { |
