Skip to content

Commit 1179f5b

Browse files
authored
Hide call to unsafe method inside of an unsafe block in rooting macro. (#519)
Signed-off-by: Josh Matthews <[email protected]>
1 parent 2087c35 commit 1179f5b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mozjs/src/gc/macros.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ macro_rules! rooted {
1818
};
1919
(in($cx:expr) let $($var:ident)+: $type:ty) => {
2020
let mut __root = $crate::jsapi::Rooted::new_unrooted();
21+
// SAFETY:
22+
// We're immediately storing the initial value in a rooted location.
2123
let $($var)+: $crate::gc::RootedGuard<$type> = $crate::gc::RootedGuard::new(
2224
$cx,
2325
&mut __root,
24-
<$type as $crate::gc::GCMethods>::initial(),
26+
unsafe { <$type as $crate::gc::GCMethods>::initial() },
2527
);
2628
};
2729
}

0 commit comments

Comments
 (0)