diff --git a/src/private.rs b/src/private.rs index affb7910..c1c7657d 100644 --- a/src/private.rs +++ b/src/private.rs @@ -20,7 +20,7 @@ extern "C" { impl Private { /// Create a private symbol. If name is not empty, it will be the description. pub fn new<'s>( - scope: &mut HandleScope<'s>, + scope: &mut HandleScope<'s, ()>, name: Option>, ) -> Local<'s, Private> { unsafe { @@ -42,7 +42,7 @@ impl Private { /// To minimize the potential for clashes, use qualified names as keys, /// e.g., "Class#property". pub fn for_api<'s>( - scope: &mut HandleScope<'s>, + scope: &mut HandleScope<'s, ()>, name: Option>, ) -> Local<'s, Private> { unsafe { @@ -57,7 +57,7 @@ impl Private { } /// Returns the print name string of the private symbol, or undefined if none. - pub fn name<'s>(&self, scope: &mut HandleScope<'s>) -> Local<'s, Value> { + pub fn name<'s>(&self, scope: &mut HandleScope<'s, ()>) -> Local<'s, Value> { unsafe { scope.cast_local(|_| v8__Private__Name(&*self)) }.unwrap() } } diff --git a/tests/test_api.rs b/tests/test_api.rs index f4ffb6fb..f8d5501d 100644 --- a/tests/test_api.rs +++ b/tests/test_api.rs @@ -3873,8 +3873,6 @@ fn private() { let _setup_guard = setup(); let isolate = &mut v8::Isolate::new(Default::default()); let scope = &mut v8::HandleScope::new(isolate); - let context = v8::Context::new(scope); - let scope = &mut v8::ContextScope::new(scope, context); let p = v8::Private::new(scope, None); assert!(p.name(scope) == v8::undefined(scope)); @@ -3891,6 +3889,9 @@ fn private() { assert!(p_api2 != p); assert!(p_api == p_api2); + let context = v8::Context::new(scope); + let scope = &mut v8::ContextScope::new(scope, context); + let object = v8::Object::new(scope); let sentinel = v8::Object::new(scope).into(); assert!(!object.has_private(scope, p).unwrap());