aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-02-03 21:05:10 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-02-03 21:05:10 -0700
commit0893326e0ea9b261c5d334067c294c7d8972d5a1 (patch)
treed91c43cbe138a37aca438f8adc6c747abafa346b /src/type.zig
parent71e0cca7a7957e2f024d2985318e478aa6fb1451 (diff)
downloadzig-0893326e0ea9b261c5d334067c294c7d8972d5a1.tar.gz
zig-0893326e0ea9b261c5d334067c294c7d8972d5a1.zip
Sema: slice improvements
* resolve_inferred_alloc now gives a proper mutability attribute to the corresponding alloc instruction. Previously, it would fail to mark things const. * slicing: fix the detection for when the end index equals the length of the underlying object. Previously it was using `end - start` but it should just use the end index directly. It also takes into account when slicing a comptime-known slice. * `Type.sentinel`: fix not handling all slice tags
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/type.zig b/src/type.zig
index 5632629bff..272d09a921 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -3042,6 +3042,9 @@ pub const Type = extern union {
.array_u8,
.manyptr_u8,
.manyptr_const_u8,
+ .const_slice_u8,
+ .const_slice,
+ .mut_slice,
=> return null,
.pointer => return self.castTag(.pointer).?.data.sentinel,