diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-06-18 17:09:10 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-06-18 17:09:10 -0400 |
| commit | 4a387996311a025a021409f08a61bab9e9885987 (patch) | |
| tree | ea36d6f87fc409b0eebc8f6149f248109b87735d /lib | |
| parent | e54ed9f638c33ec3091d207978ed856d92614caf (diff) | |
| download | zig-4a387996311a025a021409f08a61bab9e9885987.tar.gz zig-4a387996311a025a021409f08a61bab9e9885987.zip | |
make file and fn_name fields of SourceLocation also null-terminated
One of the main motivating use cases for this language feature is
tracing/profiling tools, which expect null-terminated strings for these
values. Since the data is statically allocated, making them
additionally null-terminated comes at no cost.
This prevents the requirement of compile-time code to convert to
null-termination, which could increase the compilation time of
code with tracing enabled.
See #2029
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/builtin.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 822901be73..195b301840 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -134,8 +134,8 @@ pub const CallingConvention = enum { /// This data structure is used by the Zig language code generation and /// therefore must be kept in sync with the compiler implementation. pub const SourceLocation = struct { - file: []const u8, - fn_name: []const u8, + file: [:0]const u8, + fn_name: [:0]const u8, line: u32, column: u32, }; |
