mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Be more conservative about safety of dictionary and union values.
Mark dictionaries containing GC values as must_root, and wrap them in RootedTraceableBox in automatically-generated APIs. To accommodate union variants that are now flagged as unsafe, add RootedTraceableBox to union variants that need to be rooted, rather than wrapping the entire union value.
This commit is contained in:
parent
e481e8934a
commit
da65698c5c
5 changed files with 47 additions and 17 deletions
|
@ -745,6 +745,7 @@ impl<'a, T: JSTraceable + 'static> Drop for RootedTraceable<'a, T> {
|
|||
/// If you have GC things like *mut JSObject or JSVal, use rooted!.
|
||||
/// If you have an arbitrary number of DomObjects to root, use rooted_vec!.
|
||||
/// If you know what you're doing, use this.
|
||||
#[allow_unrooted_interior]
|
||||
pub struct RootedTraceableBox<T: 'static + JSTraceable> {
|
||||
ptr: *mut T,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue