use block break instead of return

This commit is contained in:
marko 2025-09-17 14:33:40 +02:00 committed by Andrew Kelley
parent ae00a2a84d
commit 4314c9653a

View file

@ -137,7 +137,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
}
},
.@"union" => |info| {
.@"union" => |info| blk: {
if (info.tag_type) |tag_type| {
const tag = std.meta.activeTag(key);
hash(hasher, tag, strat);
@ -146,9 +146,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
if (field.type != void) {
hash(hasher, @field(key, field.name), strat);
}
// TODO use a labelled break when it does not crash the compiler. cf #2908
// break :blk;
return;
break :blk;
}
}
unreachable;