Open awesomekling opened 5 months ago
Hey I would like to take this but i'm not sure what you mean with "complain", do you mean a compile-time error that blocks the build if such patterns are detected, or a compile time warning that notifies the developer of the unsafe usage without stopping the build? I am considering using static_assert for errors or a custom type trait with a [[deprecated]] attribute for warnings
Putting e.g a
Vector<JS::GCPtr<JS::Object>>
on the stack is not safe, asVector
is backed by malloc memory.Consequently, it's also inappropriate as a function return type.
We should complain about this, so the user can switch to using
MarkedVector<JS::GCPtr<JS::Object>>
or at leastVector<JS::Handle<JS::Object>>
.We need to do this for all malloc-backed containers, but for simplicity let's say: Vector, HashMap, HashTable, and Queue.
Funding