Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Commit

Permalink
Auto merge of #394 - Xanewok:tyvar_behind_raw_pointer, r=jdm
Browse files Browse the repository at this point in the history
Fix tyvar_behind_raw_pointer warnings

As tracked at rust-lang/rust#46906, checked with rustc 1.26.0-nightly (9cb18a92a 2018-03-02) here and using patched mozjs in Servo (rustc 1.25.0-nightly (15a1e2844 2018-01-20)).

r? @jdm

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-mozjs/394)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo authored Mar 8, 2018
2 parents 5891e73 + d9dedf2 commit baf85c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ impl<'a> CapturedJSStack<'a> {
pub fn as_string(&self, indent: Option<usize>) -> Option<String> {
unsafe {
let stack_handle = self.stack.handle();
rooted!(in(self.cx) let mut js_string = ptr::null_mut());
rooted!(in(self.cx) let mut js_string = ptr::null_mut::<JSString>());
let string_handle = js_string.handle_mut();

if !IsSavedFrame(stack_handle.get()) {
Expand Down
9 changes: 5 additions & 4 deletions tests/typedarray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern crate mozjs;

use mozjs::jsapi::CompartmentOptions;
use mozjs::jsapi::JSAutoCompartment;
use mozjs::jsapi::JSObject;
use mozjs::jsapi::JS_NewGlobalObject;
use mozjs::jsapi::OnNewGlobalHookOption;
use mozjs::jsapi::Type;
Expand Down Expand Up @@ -44,7 +45,7 @@ fn typedarray() {
typedarray!(in(cx) let view: ArrayBufferView = rval.to_object());
assert_eq!(view.unwrap().get_array_type(), Type::Uint8);

rooted!(in(cx) let mut rval = ptr::null_mut());
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
assert!(Uint32Array::create(cx, CreateWith::Slice(&[1, 3, 5]), rval.handle_mut()).is_ok());

typedarray!(in(cx) let array: Uint32Array = rval.get());
Expand All @@ -54,11 +55,11 @@ fn typedarray() {
array.as_mut().unwrap().update(&[2, 4, 6]);
assert_eq!(array.unwrap().as_slice(), &[2, 4, 6][..]);

rooted!(in(cx) let rval = ptr::null_mut());
rooted!(in(cx) let rval = ptr::null_mut::<JSObject>());
typedarray!(in(cx) let array: Uint8Array = rval.get());
assert!(array.is_err());

rooted!(in(cx) let mut rval = ptr::null_mut());
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
assert!(Uint32Array::create(cx, CreateWith::Length(5), rval.handle_mut()).is_ok());

typedarray!(in(cx) let array: Uint32Array = rval.get());
Expand Down Expand Up @@ -87,7 +88,7 @@ fn typedarray_update_panic() {
);

let _ac = JSAutoCompartment::new(cx, global.get());
rooted!(in(cx) let mut rval = ptr::null_mut());
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
let _ = Uint32Array::create(cx, CreateWith::Slice(&[1, 2, 3, 4, 5]), rval.handle_mut());
typedarray!(in(cx) let mut array: Uint32Array = rval.get());
array.as_mut().unwrap().update(&[0, 2, 4, 6, 8, 10]);
Expand Down

0 comments on commit baf85c5

Please sign in to comment.