don't crash when can't evaluate comptime expression with inferred type

Closes #15911.
This commit is contained in:
yujiri8
2023-05-31 07:15:52 -04:00
committed by GitHub
parent 32e719e070
commit cd1417dbdf
3 changed files with 24 additions and 3 deletions

View File

@@ -6021,6 +6021,10 @@ pub fn errNoteNonLazy(
comptime format: []const u8,
args: anytype,
) error{OutOfMemory}!void {
if (src_loc.lazy == .unneeded) {
assert(parent.src_loc.lazy == .unneeded);
return;
}
const msg = try std.fmt.allocPrint(mod.gpa, format, args);
errdefer mod.gpa.free(msg);