Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to rustc 1.24.0-nightly (0a3761e63 2018-01-03) #19683

Merged
merged 6 commits into from Jan 10, 2018

Fix tyvar_behind_raw_pointer warnings

  • Loading branch information
SimonSapin committed Jan 10, 2018
commit 4d459bce32a48e040399b3e05e66ba5ea26dd7f1
@@ -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 @@ def CopyUnforgeablePropertiesToInstance(descriptor):
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 @@ def definition_body(self):
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 @@ def definition_body(self):
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 @@ def definition_body(self):
(*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 @@ def definition_body(self):
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 @@ def definition_body(self):
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 @@ def definition_body(self):
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 @@ def definition_body(self):
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,15 +2862,15 @@ def definition_body(self):
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("""
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 @@ def defineAliasesFor(m):
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 @@ def definition_body(self):
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 @@ def getBody(self):

# 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 @@ def getBody(self):

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 @@ def getBody(self):

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 @@ def getBody(self):
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 @@ def __init__(self, descriptor):
# 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 @@ def definition_body(self):
}
// 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 @@ def getMethodImpls(self, method):

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 @@ def getMethodImpls(self, method):
})
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;
}
@@ -29,7 +29,7 @@ use html5ever::{LocalName, Namespace, Prefix};
use js::conversions::ToJSValConvertible;
use js::glue::UnwrapObject;
use js::jsapi::{Construct1, IsCallable, IsConstructor, HandleValueArray, HandleObject, MutableHandleValue};
use js::jsapi::{Heap, JS_GetProperty, JS_SameValue, JSAutoCompartment, JSContext};
use js::jsapi::{Heap, JS_GetProperty, JS_SameValue, JSAutoCompartment, JSContext, JSObject};
use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue};
use microtask::Microtask;
use script_thread::ScriptThread;
@@ -436,7 +436,7 @@ impl CustomElementDefinition {
let cx = window.get_cx();
// Step 2
rooted!(in(cx) let constructor = ObjectValue(self.constructor.callback()));
rooted!(in(cx) let mut element = ptr::null_mut());
rooted!(in(cx) let mut element = ptr::null_mut::<JSObject>());
{
// Go into the constructor's compartment
let _ac = JSAutoCompartment::new(cx, self.constructor.callback());
@@ -545,7 +545,7 @@ fn run_upgrade_constructor(constructor: &Rc<Function>, element: &Element) -> Err
rooted!(in(cx) let constructor_val = ObjectValue(constructor.callback()));
rooted!(in(cx) let mut element_val = UndefinedValue());
unsafe { element.to_jsval(cx, element_val.handle_mut()); }
rooted!(in(cx) let mut construct_result = ptr::null_mut());
rooted!(in(cx) let mut construct_result = ptr::null_mut::<JSObject>());
{
// Go into the constructor's compartment
let _ac = JSAutoCompartment::new(cx, constructor.callback());
@@ -34,7 +34,7 @@ use dom::virtualmethods::VirtualMethods;
use dom::window::Window;
use dom_struct::dom_struct;
use fnv::FnvHasher;
use js::jsapi::{CompileFunction, JS_GetFunctionObject, JSAutoCompartment};
use js::jsapi::{CompileFunction, JS_GetFunctionObject, JSAutoCompartment, JSFunction};
use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper};
use libc::{c_char, size_t};
use servo_atoms::Atom;
@@ -443,7 +443,7 @@ impl EventTarget {
let scopechain = AutoObjectVectorWrapper::new(cx);

let _ac = JSAutoCompartment::new(cx, window.reflector().get_jsobject().get());
rooted!(in(cx) let mut handler = ptr::null_mut());
rooted!(in(cx) let mut handler = ptr::null_mut::<JSFunction>());
let rv = unsafe {
CompileFunction(cx,
scopechain.ptr,
@@ -26,6 +26,7 @@ use hyper::mime::{Attr, Mime};
use js::jsapi::Heap;
use js::jsapi::JSAutoCompartment;
use js::jsapi::JSContext;
use js::jsapi::JSObject;
use js::jsval::{self, JSVal};
use js::typedarray::{ArrayBuffer, CreateWith};
use servo_atoms::Atom;
@@ -261,7 +262,7 @@ impl FileReader {
fn perform_readasarraybuffer(result: &DomRefCell<Option<FileReaderResult>>,
cx: *mut JSContext, _: ReadMetaData, bytes: &[u8]) {
unsafe {
rooted!(in(cx) let mut array_buffer = ptr::null_mut());
rooted!(in(cx) let mut array_buffer = ptr::null_mut::<JSObject>());
assert!(ArrayBuffer::create(cx, CreateWith::Slice(bytes), array_buffer.handle_mut()).is_ok());

*result.borrow_mut() = Some(FileReaderResult::ArrayBuffer(Heap::default()));
@@ -93,7 +93,7 @@ impl Gamepad {
);

let cx = global.get_cx();
rooted!(in (cx) let mut array = ptr::null_mut());
rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>());
unsafe {
let _ = Float64Array::create(cx, CreateWith::Slice(&state.axes), array.handle_mut());
}
@@ -36,7 +36,7 @@ impl ImageData {
let len = width * height * 4;
unsafe {
let cx = global.get_cx();
rooted!(in (cx) let mut js_object = ptr::null_mut());
rooted!(in (cx) let mut js_object = ptr::null_mut::<JSObject>());
let data = match data {
Some(ref mut d) => {
d.resize(len as usize, 0);
@@ -103,7 +103,7 @@ impl ImageData {
} else {
let len = width * height * 4;
let cx = global.get_cx();
rooted!(in (cx) let mut array = ptr::null_mut());
rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>());
Uint8ClampedArray::create(cx, CreateWith::Length(len), array.handle_mut()).unwrap();
(*imagedata).data.set(array.get());
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.