authorgravatar for indocomsoft@gmail.comJulius Putra Tanu Setiaji <indocomsoft@gmail.com> 2020-12-18 11:50:52+08:00
committergravatar for indocomsoft@gmail.comJulius Putra Tanu Setiaji <indocomsoft@gmail.com> 2020-12-26 11:57:09+08:00
log1df601d5810d42f94bfe28bcbd8e9d082161bff9
treee9f88d8b407cf781760fb143db6d0a79a6e854d8
parent1634d45f1d53c8d7bfefa56ab4d2fa4cc8218b6d

Make hasUniqueRepresentation false for slices


1 files changed, 2 insertions(+), 1 deletions(-)

lib/std/meta/trait.zig+2-1
...@@ -480,7 +480,6 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {...@@ -480,7 +480,6 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {
480 .Enum,480 .Enum,
481 .ErrorSet,481 .ErrorSet,
482 .Fn,482 .Fn,
483 .Pointer,
484 => return true,483 => return true,
485484
486 .Bool => return false,485 .Bool => return false,
...@@ -489,6 +488,8 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {...@@ -489,6 +488,8 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {
489 .Int => |info| return (info.bits % 8) == 0 and488 .Int => |info| return (info.bits % 8) == 0 and
490 (info.bits == 0 or std.math.isPowerOfTwo(info.bits)),489 (info.bits == 0 or std.math.isPowerOfTwo(info.bits)),
491490
491 .Pointer => |info| return info.size != .Slice,
492
492 .Array => |info| return comptime hasUniqueRepresentation(info.child),493 .Array => |info| return comptime hasUniqueRepresentation(info.child),
493494
494 .Struct => |info| {495 .Struct => |info| {