This repository was archived by the owner on Nov 12, 2022. It is now read-only.
File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -400,11 +400,11 @@ macro_rules! rooted {
400
400
} ;
401
401
( in( $cx: expr) let $name: ident: $type: ty) => {
402
402
let mut __root = $crate:: jsapi:: Rooted :: new_unrooted( ) ;
403
- let $name = $crate:: rust:: RootedGuard :: new( $cx, & mut __root, $type:: default ( ) ) ;
403
+ let $name = $crate:: rust:: RootedGuard :: new( $cx, & mut __root, < $type as Default > :: default ( ) ) ;
404
404
} ;
405
405
( in( $cx: expr) let mut $name: ident: $type: ty) => {
406
406
let mut __root = $crate:: jsapi:: Rooted :: new_unrooted( ) ;
407
- let mut $name = $crate:: rust:: RootedGuard :: new( $cx, & mut __root, $type:: default ( ) ) ;
407
+ let mut $name = $crate:: rust:: RootedGuard :: new( $cx, & mut __root, < $type as Default > :: default ( ) ) ;
408
408
} ;
409
409
}
410
410
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ use mozjs::jsapi::JSPROP_ENUMERATE;
21
21
use mozjs:: jsapi:: JS_SetGCZeal ;
22
22
use mozjs:: jsapi:: OnNewGlobalHookOption ;
23
23
use mozjs:: jsapi:: Value ;
24
+ use mozjs:: jsval:: JSVal ;
24
25
use mozjs:: rust:: { Runtime , SIMPLE_GLOBAL_CLASS , define_methods} ;
25
26
use std:: ptr;
26
27
@@ -48,6 +49,15 @@ fn rooting() {
48
49
}
49
50
}
50
51
52
+ #[ test]
53
+ fn type_rooting ( ) {
54
+ let runtime = Runtime :: new ( ) . unwrap ( ) ;
55
+ let cx = runtime. cx ( ) ;
56
+
57
+ rooted ! ( in( cx) let root : JSVal ) ;
58
+ assert_eq ! ( root. get( ) . is_undefined( ) , true ) ;
59
+ }
60
+
51
61
unsafe extern "C" fn generic_method ( _: * mut JSContext , _: u32 , _: * mut Value ) -> bool {
52
62
true
53
63
}
You can’t perform that action at this time.
0 commit comments