Skip to content

Commit f31cf84

Browse files
committed
Hide call to unsafe method inside of an unsafe block in rooting macro.
Signed-off-by: Josh Matthews <[email protected]>
1 parent 2087c35 commit f31cf84

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mozjs/src/gc/macros.rs

+3-1
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)