authorgravatar for wrongnull@gmail.comBogdan Romanyuk <wrongnull@gmail.com> 2024-06-24 03:43:09+03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-06-24 00:43:09+00:00
logab4c461b76ff7b1d10e6d2010370ea0984f97efe
treee1214a7b089f198ce64122a373ad4d9250e0331c
parent1ede3af9f6e5923ed1e42cb33e60c0403539c221
signaturebadge-check Signed by PGP key B5690EEEBB952194

std.mem.zeroes: explicit compile error for @Type(.EnumLiteral)


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

lib/std/mem.zig+2-1
...@@ -224,7 +224,7 @@ pub fn zeroes(comptime T: type) T {...@@ -224,7 +224,7 @@ pub fn zeroes(comptime T: type) T {
224 .ComptimeInt, .Int, .ComptimeFloat, .Float => {224 .ComptimeInt, .Int, .ComptimeFloat, .Float => {
225 return @as(T, 0);225 return @as(T, 0);
226 },226 },
227 .Enum, .EnumLiteral => {227 .Enum => {
228 return @as(T, @enumFromInt(0));228 return @as(T, @enumFromInt(0));
229 },229 },
230 .Void => {230 .Void => {
...@@ -291,6 +291,7 @@ pub fn zeroes(comptime T: type) T {...@@ -291,6 +291,7 @@ pub fn zeroes(comptime T: type) T {
291 }291 }
292 @compileError("Can't set a " ++ @typeName(T) ++ " to zero.");292 @compileError("Can't set a " ++ @typeName(T) ++ " to zero.");
293 },293 },
294 .EnumLiteral,
294 .ErrorUnion,295 .ErrorUnion,
295 .ErrorSet,296 .ErrorSet,
296 .Fn,297 .Fn,