diff options
| author | Carl Åstholm <carl@astholm.se> | 2024-01-07 15:35:18 +0100 |
|---|---|---|
| committer | Carl Åstholm <carl@astholm.se> | 2024-01-07 15:35:18 +0100 |
| commit | a02bd81760166d679ccee0e190bf62115272ffbe (patch) | |
| tree | e800cf9fec8bf55898a966ca2bae2d4707707db2 /src/InternPool.zig | |
| parent | 804cee3b93cb7084c16ee61d3bcb57f7d3c9f0bc (diff) | |
| download | zig-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 'src/InternPool.zig')
0 files changed, 0 insertions, 0 deletions
