authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-09-04 01:33:53-07:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-09-15 23:36:44-07:00
logfc69529dab66254d353975844034dab545a7335b
tree73fb5b1a72ba10c19c4e59b34e6866cbe2b9df6d
parent4f952c7e0e36dab15f9359f55eb8714f8fe92bcf

ErrorBundle.addOtherSourceLocation: Fix source_line ending up as garbage when source_line is 0

The zero value needs special handling since it means 'no source line' and should be preserved through the copy.

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

lib/std/zig/ErrorBundle.zig+4-1
...@@ -474,7 +474,10 @@ pub const Wip = struct {...@@ -474,7 +474,10 @@ pub const Wip = struct {
474 .span_start = other_sl.span_start,474 .span_start = other_sl.span_start,
475 .span_main = other_sl.span_main,475 .span_main = other_sl.span_main,
476 .span_end = other_sl.span_end,476 .span_end = other_sl.span_end,
477 .source_line = try wip.addString(other.nullTerminatedString(other_sl.source_line)),477 .source_line = if (other_sl.source_line != 0)
478 try wip.addString(other.nullTerminatedString(other_sl.source_line))
479 else
480 0,
478 .reference_trace_len = other_sl.reference_trace_len,481 .reference_trace_len = other_sl.reference_trace_len,
479 });482 });
480483