Make hasUniqueRepresentation false for slices

This commit is contained in:
Julius Putra Tanu Setiaji
2020-12-18 11:50:52 +08:00
parent 1634d45f1d
commit 1df601d581

View File

@@ -480,7 +480,6 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {
.Enum,
.ErrorSet,
.Fn,
.Pointer,
=> return true,
.Bool => return false,
@@ -489,6 +488,8 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {
.Int => |info| return (info.bits % 8) == 0 and
(info.bits == 0 or std.math.isPowerOfTwo(info.bits)),
.Pointer => |info| return info.size != .Slice,
.Array => |info| return comptime hasUniqueRepresentation(info.child),
.Struct => |info| {