| ... | @@ -501,7 +501,7 @@ pub const toSlice = @compileError("deprecated; use std.mem.spanZ"); | ... | @@ -501,7 +501,7 @@ pub const toSlice = @compileError("deprecated; use std.mem.spanZ"); |
| 501 | /// the constness of the input type. `[*c]` pointers are assumed to be 0-terminated, | 501 | /// the constness of the input type. `[*c]` pointers are assumed to be 0-terminated, |
| 502 | /// and assumed to not allow null. | 502 | /// and assumed to not allow null. |
| 503 | pub fn Span(comptime T: type) type { | 503 | pub fn Span(comptime T: type) type { |
| 504 | switch(@typeInfo(T)) { | 504 | switch (@typeInfo(T)) { |
| 505 | .Optional => |optional_info| { | 505 | .Optional => |optional_info| { |
| 506 | return ?Span(optional_info.child); | 506 | return ?Span(optional_info.child); |
| 507 | }, | 507 | }, |
| ... | @@ -1758,7 +1758,8 @@ fn BytesAsValueReturnType(comptime T: type, comptime B: type) type { | ... | @@ -1758,7 +1758,8 @@ fn BytesAsValueReturnType(comptime T: type, comptime B: type) type { |
| 1758 | if (comptime !trait.is(.Pointer)(B) or | 1758 | if (comptime !trait.is(.Pointer)(B) or |
| 1759 | (meta.Child(B) != [size]u8 and meta.Child(B) != [size:0]u8)) | 1759 | (meta.Child(B) != [size]u8 and meta.Child(B) != [size:0]u8)) |
| 1760 | { | 1760 | { |
| 1761 | @compileError("expected *[N]u8 " ++ ", passed " ++ @typeName(B)); | 1761 | comptime var buf: [100]u8 = undefined; |
| | 1762 | @compileError(std.fmt.bufPrint(&buf, "expected *[{}]u8, passed " ++ @typeName(B), .{size}) catch unreachable); |
| 1762 | } | 1763 | } |
| 1763 | | 1764 | |
| 1764 | const alignment = comptime meta.alignment(B); | 1765 | const alignment = comptime meta.alignment(B); |