aboutsummaryrefslogtreecommitdiff
path: root/lib/std/builtin.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-08-24 16:16:53 +0100
committermlugg <mlugg@mlugg.co.uk>2024-08-27 00:44:35 +0100
commit6808ce27bdca14d3876ac607c94f75ea054db7b8 (patch)
treec30b229113d60243a1257fad597ec919c99e3dad /lib/std/builtin.zig
parenta3a737e9a68fae96519743a644209b4a30cf3b58 (diff)
downloadzig-6808ce27bdca14d3876ac607c94f75ea054db7b8.tar.gz
zig-6808ce27bdca14d3876ac607c94f75ea054db7b8.zip
compiler,lib,test,langref: migrate `@setCold` to `@branchHint`
Diffstat (limited to 'lib/std/builtin.zig')
-rw-r--r--lib/std/builtin.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index 9dcefd2b11..6028db83a0 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -779,7 +779,7 @@ else
/// This function is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.
pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr: ?usize) noreturn {
- @setCold(true);
+ @branchHint(.cold);
// For backends that cannot handle the language features depended on by the
// default panic handler, we have a simpler panic handler:
@@ -896,27 +896,27 @@ pub fn checkNonScalarSentinel(expected: anytype, actual: @TypeOf(expected)) void
}
pub fn panicSentinelMismatch(expected: anytype, actual: @TypeOf(expected)) noreturn {
- @setCold(true);
+ @branchHint(.cold);
std.debug.panicExtra(null, @returnAddress(), "sentinel mismatch: expected {any}, found {any}", .{ expected, actual });
}
pub fn panicUnwrapError(st: ?*StackTrace, err: anyerror) noreturn {
- @setCold(true);
+ @branchHint(.cold);
std.debug.panicExtra(st, @returnAddress(), "attempt to unwrap error: {s}", .{@errorName(err)});
}
pub fn panicOutOfBounds(index: usize, len: usize) noreturn {
- @setCold(true);
+ @branchHint(.cold);
std.debug.panicExtra(null, @returnAddress(), "index out of bounds: index {d}, len {d}", .{ index, len });
}
pub fn panicStartGreaterThanEnd(start: usize, end: usize) noreturn {
- @setCold(true);
+ @branchHint(.cold);
std.debug.panicExtra(null, @returnAddress(), "start index {d} is larger than end index {d}", .{ start, end });
}
pub fn panicInactiveUnionField(active: anytype, wanted: @TypeOf(active)) noreturn {
- @setCold(true);
+ @branchHint(.cold);
std.debug.panicExtra(null, @returnAddress(), "access of union field '{s}' while field '{s}' is active", .{ @tagName(wanted), @tagName(active) });
}
@@ -949,7 +949,7 @@ pub const panic_messages = struct {
};
pub noinline fn returnError(st: *StackTrace) void {
- @setCold(true);
+ @branchHint(.cold);
@setRuntimeSafety(false);
addErrRetTraceAddr(st, @returnAddress());
}