mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
try fix return pointer alignment mismatch
This commit is contained in:
parent
58ecb6952f
commit
a6601b542c
1 changed files with 4 additions and 2 deletions
|
|
@ -131,7 +131,8 @@ fn platform_main() !void {
|
|||
// Simple(Model) is a tag union, so it has a discriminant + payload
|
||||
// For now, just treat it as a blob and check we can call without crashing
|
||||
try stdout.print("\n=== Test 2: render(Box(model)) -> Simple(Model) ===\n", .{});
|
||||
var render_result: [64]u8 = undefined; // Buffer for opaque result
|
||||
// Use aligned buffer - Simple(Model) contains Str which requires pointer alignment
|
||||
var render_result: [64]u8 align(@alignOf(usize)) = undefined;
|
||||
roc__render(&roc_ops, @as(*anyopaque, @ptrCast(&render_result)), @as(*anyopaque, @ptrCast(&boxed_model)));
|
||||
try stdout.print("render completed without crash\n", .{});
|
||||
try stdout.print("\x1b[32mSUCCESS\x1b[0m: render returned Simple(Model)!\n", .{});
|
||||
|
|
@ -149,7 +150,8 @@ fn platform_main() !void {
|
|||
|
||||
// Test 4: render the updated model
|
||||
try stdout.print("\n=== Test 4: render(updated Box(model)) -> Simple(Model) ===\n", .{});
|
||||
var final_result: [64]u8 = undefined;
|
||||
// Use aligned buffer - Simple(Model) contains Str which requires pointer alignment
|
||||
var final_result: [64]u8 align(@alignOf(usize)) = undefined;
|
||||
roc__render(&roc_ops, @as(*anyopaque, @ptrCast(&final_result)), @as(*anyopaque, @ptrCast(&new_boxed_model)));
|
||||
try stdout.print("render completed without crash\n", .{});
|
||||
try stdout.print("\x1b[32mSUCCESS\x1b[0m: render returned Simple(Model)!\n", .{});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue