mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
CompiledRegex held an FFI handle with unique ownership and panicked on clone. This caused a crash when a class field initializer contained a regex literal, since the codegen wraps field initializers in a synthetic function body by cloning the expression. Wrapping CompiledRegex in Rc makes the clone a cheap refcount bump. The take() semantics are preserved: the first codegen path to call take() gets the handle, and Drop frees it if nobody took it.