authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-05-11 22:21:22+02:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-05-11 22:22:21+02:00
logc0369575218d3dccb69f62495de31c8e22d41ae9
tree6f5f3cb32c6886f0dcd7400d6507c1fd6ffd03d0
parentace5714551da16b541d8015e97a2fe32a7a1cf76
signaturelock-open Commit is signed but in an unrecognized format.

std.meta.Elem: support all optional types


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

lib/std/meta.zig+1-7
...@@ -175,13 +175,7 @@ pub fn Elem(comptime T: type) type {...@@ -175,13 +175,7 @@ pub fn Elem(comptime T: type) type {
175 },175 },
176 .Many, .C, .Slice => return info.child,176 .Many, .C, .Slice => return info.child,
177 },177 },
178 .Optional => |info| switch (@typeInfo(info.child)) {178 .Optional => |info| return Elem(info.child),
179 .Pointer => |ptr_info| switch (ptr_info.size) {
180 .Many => return ptr_info.child,
181 else => {},
182 },
183 else => {},
184 },
185 else => {},179 else => {},
186 }180 }
187 @compileError("Expected pointer, slice, array or vector type, found '" ++ @typeName(T) ++ "'");181 @compileError("Expected pointer, slice, array or vector type, found '" ++ @typeName(T) ++ "'");