aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-06-04 16:29:26 -0400
committerGitHub <noreply@github.com>2022-06-04 16:29:26 -0400
commit43db697b46e362e5991005f6c7b8b16ddc9bddbb (patch)
treee53320c89cff35f60a1e11e57a0c938f0b793021 /lib/std/meta.zig
parente498fb155051f548071da1a13098b8793f527275 (diff)
parent50a6b0f3acb2a17f74d57301dbf3d4b13e30953b (diff)
downloadzig-43db697b46e362e5991005f6c7b8b16ddc9bddbb.tar.gz
zig-43db697b46e362e5991005f6c7b8b16ddc9bddbb.zip
Merge pull request #11789 from Vexu/stage2
Stage2 fixes towards `zig2 build test-std` working
Diffstat (limited to 'lib/std/meta.zig')
-rw-r--r--lib/std/meta.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index 0de51bfa68..c6717ad1c0 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -311,7 +311,10 @@ pub fn assumeSentinel(p: anytype, comptime sentinel_val: Elem(@TypeOf(p))) Senti
const ReturnType = Sentinel(T, sentinel_val);
switch (@typeInfo(T)) {
.Pointer => |info| switch (info.size) {
- .Slice => return @bitCast(ReturnType, p),
+ .Slice => if (@import("builtin").zig_backend == .stage1)
+ return @bitCast(ReturnType, p)
+ else
+ return @ptrCast(ReturnType, p),
.Many, .One => return @ptrCast(ReturnType, p),
.C => {},
},