Skip to content

Commit 5c1523b

Browse files
committed
Duplicate JSID_VOID symbol.
1 parent 73bd2f1 commit 5c1523b

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ const WHITELIST_VARS: &'static [&'static str] = &[
286286
"JSCLASS_.*",
287287
"JSFUN_.*",
288288
"JSITER_.*",
289-
"JSID_VOID",
290289
"JSPROP_.*",
291290
"JS_.*",
292291
];

src/jsgc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use jsapi::JS;
66
use jsapi::jsid;
77
use jsapi::JSFlatString;
88
use jsapi::JSFunction;
9-
use jsapi::JSID_VOID;
109
use jsapi::JSObject;
1110
use jsapi::JSScript;
1211
use jsapi::JSString;
1312
use jsapi::JSTracer;
13+
use jsid::JSID_VOID;
1414

1515
use std::cell::UnsafeCell;
1616
use std::mem;

src/jsid.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
use jsapi::jsid;
6+
7+
// No symbol generated for implicitly initialized constexpr, so we
8+
// need to duplicate the necessary values.
9+
pub const JSID_TYPE_VOID: usize = 0x02;
10+
pub const JSID_VOID: jsid = jsid { asBits: JSID_TYPE_VOID };

src/jsimpls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use jsapi::JSAutoRealm;
77
use jsapi::JSContext;
88
use jsapi::JSErrNum;
99
use jsapi::JSFunctionSpec;
10-
use jsapi::JSID_VOID;
1110
use jsapi::JSJitGetterCallArgs;
1211
use jsapi::JSJitMethodCallArgs;
1312
use jsapi::JSJitSetterCallArgs;
@@ -19,6 +18,7 @@ use jsapi::glue::JS_ForOfIteratorInit;
1918
use jsapi::glue::JS_ForOfIteratorNext;
2019
use jsapi::jsid;
2120
use jsgc::RootKind;
21+
use jsid::JSID_VOID;
2222
use jsval::UndefinedValue;
2323

2424
#[cfg(feature = "debugmozjs")]
@@ -52,7 +52,7 @@ impl<T> DerefMut for JS::MutableHandle<T> {
5252
}
5353

5454
impl Default for jsid {
55-
fn default() -> Self { unsafe { JSID_VOID } }
55+
fn default() -> Self { JSID_VOID }
5656
}
5757

5858
impl Default for JS::RealmOptions {

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mod jsimpls;
1111

1212
// Modules with public definitions
1313
pub mod jsgc;
14+
pub mod jsid;
1415
pub mod jsjit;
1516
pub mod jsval;
1617

0 commit comments

Comments
 (0)