master
1//! []One -> []Two (small to big, divides neatly)
2
3const One = u8;
4const Two = [2]u8;
5
6/// A runtime-known value to prevent these safety panics from being compile errors.
7var rt: u8 = 0;
8
9pub fn main() void {
10 const in: []const One = &.{ 1, 0, rt };
11 const out: []const Two = @ptrCast(in);
12 _ = out;
13 std.process.exit(1);
14}
15
16pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {
17 if (std.mem.eql(u8, message, "slice length '3' does not divide exactly into destination elements")) {
18 std.process.exit(0);
19 }
20 std.process.exit(1);
21}
22
23const std = @import("std");
24
25// run
26// backend=selfhosted,llvm
27// target=x86_64-linux,aarch64-linux