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

Fix tyvar_behind_raw_pointer warnings #394

Merged
merged 1 commit into from
Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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