AK: Match Rust panic callback parameter types to the FFI

Use byte pointers for the panic message and source filename, matching
the declarations generated from Rust. This allows AssertionFailure.h
and Rust FFI headers to be included in the same translation unit.
This commit is contained in:
Timothy Flynn authored and Tim Flynn committed 2026-10-27 14:16:53 -04:00
1 parent cea6306ab5
commit 6fa4b3f87a
2 files changed
+4 -4
Notes: github-actions[bot] 2026-10-27 19:42:02 +00:00

No files matched your search

+1 -1
View File
@@ -46,7 +46,7 @@ char const* current_rust_panic_message();
}
extern "C" void ladybird_rust_panic(char const*, size_t, char const*, size_t, u32, u32, bool (*)());
extern "C" void ladybird_rust_panic(u8 const*, size_t, u8 const*, size_t, u32, u32, bool (*)());
extern "C" void ladybird_rust_panic_hook_returned();
extern "C" void ladybird_rust_panic_may_abort();
extern "C" void ladybird_rust_panic_will_abort();
+3 -3
View File
@@ -53,7 +53,7 @@ static thread_local bool s_rust_panic_backtrace_captured;
static thread_local bool s_capturing_backtrace_quietly;
#endif
void ladybird_rust_panic(char const* message, size_t message_length, char const* filename, size_t filename_length, u32 line, u32 column, bool (*is_panicking)())
void ladybird_rust_panic(u8 const* message, size_t message_length, u8 const* filename, size_t filename_length, u32 line, u32 column, bool (*is_panicking)())
{
++s_rust_panic_hook_depth;
__atomic_store_n(&s_rust_is_panicking, nullptr, __ATOMIC_RELEASE);
@@ -65,7 +65,7 @@ void ladybird_rust_panic(char const* message, size_t message_length, char const*
s_rust_panic_message[length++] = ch ? ch : '?';
}
};
append({ message, min(message_length, 4096uz) });
append({ reinterpret_cast<char const*>(message), min(message_length, 4096uz) });
if (message_length > 4096)
append(" [truncated]"sv);
if (filename_length) {
@@ -73,7 +73,7 @@ void ladybird_rust_panic(char const* message, size_t message_length, char const*
if (filename_length > 4096) {
append("[location unavailable]"sv);
} else {
append({ filename, filename_length });
append({ reinterpret_cast<char const*>(filename), filename_length });
Array<char, 24> location;
auto count = snprintf(location.data(), location.size(), ":%u:%u", line, column);
if (count > 0)