master
1//! []Three -> []Two (big to small, does not divide)
2
3const Two = [2]u8;
4const Three = [3]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 Three = &.{.{ 0, 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 '1' 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