mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix tyvar_behind_raw_pointer warnings
https://github.com/rust-lang/rust/issues/46906
This commit is contained in:
parent
cee2aadd82
commit
4d459bce32
20 changed files with 55 additions and 53 deletions
|
@ -2539,7 +2539,7 @@ def CopyUnforgeablePropertiesToInstance(descriptor):
|
|||
# reflector, so we can make sure we don't get confused by named getters.
|
||||
if descriptor.proxy:
|
||||
copyCode += """\
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
ensure_expando_object(cx, obj.handle(), expando.handle_mut());
|
||||
"""
|
||||
obj = "expando"
|
||||
|
@ -2554,7 +2554,7 @@ ensure_expando_object(cx, obj.handle(), expando.handle_mut());
|
|||
else:
|
||||
copyFunc = "JS_InitializePropertiesFromCompatibleNativeObject"
|
||||
copyCode += """\
|
||||
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut());
|
||||
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
|
||||
unforgeable_holder.handle_mut().set(
|
||||
JS_GetReservedSlot(proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT).to_object());
|
||||
assert!(%(copyFunc)s(cx, %(obj)s.handle(), unforgeable_holder.handle()));
|
||||
|
@ -2586,7 +2586,7 @@ let scope = scope.reflector().get_jsobject();
|
|||
assert!(!scope.get().is_null());
|
||||
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
|
||||
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
let _ac = JSAutoCompartment::new(cx, scope.get());
|
||||
GetProtoObject(cx, scope, proto.handle_mut());
|
||||
assert!(!proto.is_null());
|
||||
|
@ -2631,7 +2631,7 @@ class CGWrapGlobalMethod(CGAbstractMethod):
|
|||
let raw = Box::into_raw(object);
|
||||
let _rt = RootedTraceable::new(&*raw);
|
||||
|
||||
rooted!(in(cx) let mut obj = ptr::null_mut());
|
||||
rooted!(in(cx) let mut obj = ptr::null_mut::<JSObject>());
|
||||
create_global_object(
|
||||
cx,
|
||||
&Class.base,
|
||||
|
@ -2643,7 +2643,7 @@ assert!(!obj.is_null());
|
|||
(*raw).init_reflector(obj.get());
|
||||
|
||||
let _ac = JSAutoCompartment::new(cx, obj.get());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
GetProtoObject(cx, obj.handle(), proto.handle_mut());
|
||||
assert!(JS_SplicePrototype(cx, obj.handle(), proto.handle()));
|
||||
let mut immutable = false;
|
||||
|
@ -2771,7 +2771,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
|
|||
return CGGeneric("""\
|
||||
rooted!(in(cx) let proto = %(proto)s);
|
||||
assert!(!proto.is_null());
|
||||
rooted!(in(cx) let mut namespace = ptr::null_mut());
|
||||
rooted!(in(cx) let mut namespace = ptr::null_mut::<JSObject>());
|
||||
create_namespace_object(cx, global, proto.handle(), &NAMESPACE_OBJECT_CLASS,
|
||||
%(methods)s, %(name)s, namespace.handle_mut());
|
||||
assert!(!namespace.is_null());
|
||||
|
@ -2784,7 +2784,7 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
|
|||
if self.descriptor.interface.isCallback():
|
||||
assert not self.descriptor.interface.ctor() and self.descriptor.interface.hasConstants()
|
||||
return CGGeneric("""\
|
||||
rooted!(in(cx) let mut interface = ptr::null_mut());
|
||||
rooted!(in(cx) let mut interface = ptr::null_mut::<JSObject>());
|
||||
create_callback_interface_object(cx, global, sConstants, %(name)s, interface.handle_mut());
|
||||
assert!(!interface.is_null());
|
||||
assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
|
||||
|
@ -2807,7 +2807,7 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
|
|||
toBindingNamespace(parentName))
|
||||
|
||||
code = [CGGeneric("""\
|
||||
rooted!(in(cx) let mut prototype_proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
|
||||
%s;
|
||||
assert!(!prototype_proto.is_null());""" % getPrototypeProto)]
|
||||
|
||||
|
@ -2835,7 +2835,7 @@ assert!(!prototype_proto.is_null());""" % getPrototypeProto)]
|
|||
proto_properties = properties
|
||||
|
||||
code.append(CGGeneric("""
|
||||
rooted!(in(cx) let mut prototype = ptr::null_mut());
|
||||
rooted!(in(cx) let mut prototype = ptr::null_mut::<JSObject>());
|
||||
create_interface_prototype_object(cx,
|
||||
prototype_proto.handle(),
|
||||
&PrototypeClass,
|
||||
|
@ -2862,7 +2862,7 @@ assert!((*cache)[PrototypeList::ID::%(id)s as usize].is_null());
|
|||
if parentName:
|
||||
parentName = toBindingNamespace(parentName)
|
||||
code.append(CGGeneric("""
|
||||
rooted!(in(cx) let mut interface_proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
|
||||
%s::GetConstructorObject(cx, global, interface_proto.handle_mut());""" % parentName))
|
||||
else:
|
||||
code.append(CGGeneric("""
|
||||
|
@ -2870,7 +2870,7 @@ rooted!(in(cx) let interface_proto = JS_GetFunctionPrototype(cx, global));"""))
|
|||
code.append(CGGeneric("""\
|
||||
assert!(!interface_proto.is_null());
|
||||
|
||||
rooted!(in(cx) let mut interface = ptr::null_mut());
|
||||
rooted!(in(cx) let mut interface = ptr::null_mut::<JSObject>());
|
||||
create_noncallback_interface_object(cx,
|
||||
global,
|
||||
interface_proto.handle(),
|
||||
|
@ -2973,7 +2973,7 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
|
|||
holderClass = "&Class.base as *const JSClass"
|
||||
holderProto = "prototype.handle()"
|
||||
code.append(CGGeneric("""
|
||||
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut());
|
||||
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
|
||||
unforgeable_holder.handle_mut().set(
|
||||
JS_NewObjectWithoutMetadata(cx, %(holderClass)s, %(holderProto)s));
|
||||
assert!(!unforgeable_holder.is_null());
|
||||
|
@ -3151,7 +3151,7 @@ if !ConstructorEnabled(cx, global) {
|
|||
return;
|
||||
}
|
||||
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
%s(cx, global, proto.handle_mut());
|
||||
assert!(!proto.is_null());""" % (function,))
|
||||
|
||||
|
@ -4941,7 +4941,7 @@ if %s {
|
|||
|
||||
# FIXME(#11868) Should assign to desc.obj, desc.get() is a copy.
|
||||
return get + """\
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
//if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) {
|
||||
if !expando.is_null() {
|
||||
|
@ -5071,7 +5071,7 @@ class CGDOMJSProxyHandler_ownPropertyKeys(CGAbstractExternMethod):
|
|||
|
||||
body += dedent(
|
||||
"""
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
if !expando.is_null() {
|
||||
GetPropertyKeys(cx, expando.handle(), JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props);
|
||||
|
@ -5114,7 +5114,7 @@ class CGDOMJSProxyHandler_getOwnEnumerablePropertyKeys(CGAbstractExternMethod):
|
|||
|
||||
body += dedent(
|
||||
"""
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
if !expando.is_null() {
|
||||
GetPropertyKeys(cx, expando.handle(), JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props);
|
||||
|
@ -5173,7 +5173,7 @@ if %s {
|
|||
named = ""
|
||||
|
||||
return indexed + """\
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
if !expando.is_null() {
|
||||
let ok = JS_HasPropertyById(cx, expando.handle(), id, bp);
|
||||
|
@ -5200,7 +5200,7 @@ class CGDOMJSProxyHandler_get(CGAbstractExternMethod):
|
|||
# https://heycam.github.io/webidl/#LegacyPlatformObjectGetOwnProperty
|
||||
def getBody(self):
|
||||
getFromExpando = """\
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
if !expando.is_null() {
|
||||
let mut hasProp = false;
|
||||
|
@ -5406,7 +5406,7 @@ if args.callee() == new_target.get() {
|
|||
}
|
||||
|
||||
// Step 6
|
||||
rooted!(in(cx) let mut prototype = ptr::null_mut());
|
||||
rooted!(in(cx) let mut prototype = ptr::null_mut::<JSObject>());
|
||||
{
|
||||
rooted!(in(cx) let mut proto_val = UndefinedValue());
|
||||
let _ac = JSAutoCompartment::new(cx, new_target.get());
|
||||
|
@ -6594,7 +6594,7 @@ class CGCallback(CGClass):
|
|||
|
||||
bodyWithThis = string.Template(
|
||||
setupCall +
|
||||
"rooted!(in(s.get_context()) let mut thisObjJS = ptr::null_mut());\n"
|
||||
"rooted!(in(s.get_context()) let mut thisObjJS = ptr::null_mut::<JSObject>());\n"
|
||||
"wrap_call_this_object(s.get_context(), thisObj, thisObjJS.handle_mut());\n"
|
||||
"if thisObjJS.is_null() {\n"
|
||||
" return Err(JSFailed);\n"
|
||||
|
@ -6605,7 +6605,7 @@ class CGCallback(CGClass):
|
|||
})
|
||||
bodyWithoutThis = string.Template(
|
||||
setupCall +
|
||||
"rooted!(in(s.get_context()) let thisObjJS = ptr::null_mut());\n"
|
||||
"rooted!(in(s.get_context()) let thisObjJS = ptr::null_mut::<JSObject>());\n"
|
||||
"return ${methodName}(${callArgs});").substitute({
|
||||
"callArgs": ", ".join(argnamesWithoutThis),
|
||||
"methodName": 'self.' + method.name,
|
||||
|
|
|
@ -81,7 +81,7 @@ use html5ever::LocalName;
|
|||
use html5ever::interface::QualName;
|
||||
use js::glue::UnwrapObject;
|
||||
use js::jsapi::{CallArgs, CurrentGlobalOrNull};
|
||||
use js::jsapi::{JSAutoCompartment, JSContext};
|
||||
use js::jsapi::{JSAutoCompartment, JSContext, JSObject};
|
||||
use js::jsapi::HandleObject;
|
||||
use js::jsapi::MutableHandleObject;
|
||||
use script_thread::ScriptThread;
|
||||
|
@ -111,7 +111,7 @@ pub unsafe fn html_constructor<T>(window: &Window, call_args: &CallArgs) -> Fall
|
|||
|
||||
{
|
||||
let _ac = JSAutoCompartment::new(window.get_cx(), callee.get());
|
||||
rooted!(in(window.get_cx()) let mut constructor = ptr::null_mut());
|
||||
rooted!(in(window.get_cx()) let mut constructor = ptr::null_mut::<JSObject>());
|
||||
rooted!(in(window.get_cx()) let global_object = CurrentGlobalOrNull(window.get_cx()));
|
||||
|
||||
if definition.is_autonomous() {
|
||||
|
|
|
@ -186,7 +186,7 @@ pub unsafe fn create_interface_prototype_object(
|
|||
create_object(cx, proto, class, regular_methods, regular_properties, constants, rval);
|
||||
|
||||
if !unscopable_names.is_empty() {
|
||||
rooted!(in(cx) let mut unscopable_obj = ptr::null_mut());
|
||||
rooted!(in(cx) let mut unscopable_obj = ptr::null_mut::<JSObject>());
|
||||
create_unscopable_object(cx, unscopable_names, unscopable_obj.handle_mut());
|
||||
|
||||
let unscopable_symbol = GetWellKnownSymbol(cx, SymbolCode::unscopables);
|
||||
|
@ -231,7 +231,7 @@ pub unsafe fn create_named_constructors(
|
|||
global: HandleObject,
|
||||
named_constructors: &[(ConstructorClassHook, &[u8], u32)],
|
||||
interface_prototype_object: HandleObject) {
|
||||
rooted!(in(cx) let mut constructor = ptr::null_mut());
|
||||
rooted!(in(cx) let mut constructor = ptr::null_mut::<JSObject>());
|
||||
|
||||
for &(native, name, arity) in named_constructors {
|
||||
assert!(*name.last().unwrap() == b'\0');
|
||||
|
|
|
@ -16,7 +16,7 @@ use dom::bindings::trace::JSTraceable;
|
|||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use js::conversions::ToJSValConvertible;
|
||||
use js::jsapi::{HandleValue, Heap, JSContext, MutableHandleObject};
|
||||
use js::jsapi::{HandleValue, Heap, JSContext, MutableHandleObject, JSObject};
|
||||
use js::jsval::UndefinedValue;
|
||||
use std::cell::Cell;
|
||||
use std::ptr;
|
||||
|
@ -76,7 +76,7 @@ impl<T: DomObject + JSTraceable + Iterable> IterableIterator<T> {
|
|||
pub fn Next(&self, cx: *mut JSContext) -> Fallible<NonNullJSObjectPtr> {
|
||||
let index = self.index.get();
|
||||
rooted!(in(cx) let mut value = UndefinedValue());
|
||||
rooted!(in(cx) let mut rval = ptr::null_mut());
|
||||
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
|
||||
let result = if index >= self.iterable.get_iterable_length() {
|
||||
dict_return(cx, rval.handle_mut(), true, value.handle())
|
||||
} else {
|
||||
|
|
|
@ -32,7 +32,7 @@ pub unsafe extern "C" fn shadow_check_callback(cx: *mut JSContext,
|
|||
-> DOMProxyShadowsResult {
|
||||
// TODO: support OverrideBuiltins when #12978 is fixed.
|
||||
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(object, expando.handle_mut());
|
||||
if !expando.get().is_null() {
|
||||
let mut has_own = false;
|
||||
|
@ -73,7 +73,7 @@ pub unsafe extern "C" fn get_property_descriptor(cx: *mut JSContext,
|
|||
return true;
|
||||
}
|
||||
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
if !GetObjectProto(cx, proxy, proto.handle_mut()) {
|
||||
// FIXME(#11868) Should assign to desc.obj, desc.get() is a copy.
|
||||
desc.get().obj = ptr::null_mut();
|
||||
|
@ -95,7 +95,7 @@ pub unsafe extern "C" fn define_property(cx: *mut JSContext,
|
|||
return true;
|
||||
}
|
||||
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
ensure_expando_object(cx, proxy, expando.handle_mut());
|
||||
JS_DefinePropertyById(cx, expando.handle(), id, desc, result)
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ pub unsafe extern "C" fn delete(cx: *mut JSContext,
|
|||
id: HandleId,
|
||||
bp: *mut ObjectOpResult)
|
||||
-> bool {
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
if expando.is_null() {
|
||||
(*bp).code_ = 0 /* OkCode */;
|
||||
|
|
|
@ -134,7 +134,7 @@ pub unsafe fn get_property_on_prototype(cx: *mut JSContext,
|
|||
found: *mut bool,
|
||||
vp: MutableHandleValue)
|
||||
-> bool {
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
if !JS_GetPrototype(cx, proxy, proto.handle_mut()) || proto.is_null() {
|
||||
*found = false;
|
||||
return true;
|
||||
|
@ -287,7 +287,7 @@ pub unsafe fn has_property_on_prototype(cx: *mut JSContext,
|
|||
id: HandleId,
|
||||
found: &mut bool)
|
||||
-> bool {
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
if !JS_GetPrototype(cx, proxy, proto.handle_mut()) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue