aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.zig
diff options
context:
space:
mode:
authorCarl Åstholm <carl@astholm.se>2024-01-07 15:35:18 +0100
committerCarl Åstholm <carl@astholm.se>2024-01-07 15:35:18 +0100
commita02bd81760166d679ccee0e190bf62115272ffbe (patch)
treee800cf9fec8bf55898a966ca2bae2d4707707db2 /lib/std/meta.zig
parent804cee3b93cb7084c16ee61d3bcb57f7d3c9f0bc (diff)
downloadzig-a02bd81760166d679ccee0e190bf62115272ffbe.tar.gz
zig-a02bd81760166d679ccee0e190bf62115272ffbe.zip
Make `@typeInfo` return null-terminated strings
Changes the types of `std.builtin.Type` `name` fields from `[]const u8` to `[:0]const u8`, which should make them easier to pass to C APIs expecting null-terminated strings. This will break code that reifies types using `[]const u8` strings, such as code that uses `std.mem.tokenize()` to construct types from strings at comptime. Luckily, the fix is simple: simply concatenate the `[]const u8` string with an empty string literal (`name ++ ""`) to explicitly coerce it to `[:0]const u8`. Co-authored-by: Krzysztof Wolicki <der.teufel.mail@gmail.com>
Diffstat (limited to 'lib/std/meta.zig')
0 files changed, 0 insertions, 0 deletions