Expand description
Faithful port of copyError (Analysis/src/Error.cpp:1463-1705).
The C++ original is a function template whose body is a chain of
if constexpr (std::is_same_v<T, ...>) branches, so the active branch is
selected at compile time from the concrete error type T the caller
instantiates it with. The faithful Rust equivalent of that compile-time
type switch is a trait: copy_error<T> forwards to T’s CopyError
implementation, and each branch of the original if constexpr cascade
becomes one impl CopyError for <ErrorType> whose body is exactly that
branch (empty for the error kinds that hold no TypeId/TypePackId).
::Luau::clone(ty, destArena, cloneState) is an overload set keyed on the
argument type; the ports preserve that as three separate free functions
(TypeId, TypePackId, TypeFun), wrapped below as clone_type,
clone_pack and clone_type_fun.
Traits§
- Copy
Error - Faithful realization of the
if constexprtype switch incopyError.
Functions§
- copy_
error template<typename T> void copyError(T& e, TypeArena& destArena, CloneState& cloneState).