From 662bc6d9ab2cf51b0e95472ddb63e713b8e346fe Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 21 Dec 2014 20:40:16 +0530 Subject: [PATCH 1/3] Update to Rust ffc111889e93bcd38222d9d74a70fdc26a78fcb5/rust-0.13.0-dev --- src/jsval.rs | 2 +- src/rust.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/jsval.rs b/src/jsval.rs index 8b5b35428..7e196ea04 100644 --- a/src/jsval.rs +++ b/src/jsval.rs @@ -82,7 +82,7 @@ const JSVAL_PAYLOAD_MASK: u64 = 0x00007FFFFFFFFFFF; // JSVal was originally type of u64. // now this become {u64} because of the union abi issue on ARM arch. See #398. -#[deriving(PartialEq,Clone)] +#[deriving(PartialEq, Clone, Copy)] pub struct JSVal { pub v: u64 } diff --git a/src/rust.rs b/src/rust.rs index cd73c43da..dbbcfcac2 100644 --- a/src/rust.rs +++ b/src/rust.rs @@ -9,7 +9,6 @@ use libc::uintptr_t; use libc::c_char; use std::cmp; use std::rc; -use std::rt::Runtime; use std::string; use jsapi::*; use jsapi::JSVersion::JSVERSION_LATEST; @@ -124,7 +123,7 @@ impl Cx { let script_utf16: Vec = script.as_slice().utf16_units().collect(); let filename_cstr = filename.to_c_str(); let mut rval: JSVal = NullValue(); - debug!("Evaluating script from {:s} with content {}", filename, script); + debug!("Evaluating script from {} with content {}", filename, script); // SpiderMonkey does not approve of null pointers. let (ptr, len) = if script_utf16.len() == 0 { static empty: &'static [u16] = &[]; @@ -154,7 +153,7 @@ pub unsafe extern fn reportError(_cx: *mut JSContext, msg: *const c_char, report let fname = if fnptr.is_not_null() {string::raw::from_buf(fnptr as *const i8 as *const u8)} else {"none".to_string()}; let lineno = (*report).lineno; let msg = string::raw::from_buf(msg as *const i8 as *const u8); - error!("Error at {:s}:{}: {:s}\n", fname, lineno, msg); + error!("Error at {}:{}: {}\n", fname, lineno, msg); } pub fn with_compartment(cx: *mut JSContext, object: *mut JSObject, cb: || -> R) -> R { From 0a3025bc11cd3f39c47acf7af65cd1979299abe9 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 5 Jan 2015 10:37:35 +0100 Subject: [PATCH 2/3] Derive Copy for js::Class. --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index 7ea1872f4..6e6becea7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -127,6 +127,7 @@ pub unsafe fn JS_CALLEE(_cx: *mut JSContext, vp: *mut JSVal) -> JSVal { pub type JSObjectOp = extern "C" fn(*mut JSContext, JSHandleObject) -> *mut JSObject; +#[deriving(Copy)] pub struct Class { pub name: *const libc::c_char, pub flags: uint32_t, From e01a846241bd98ac424878e3f8d3e9b989c79242 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 5 Jan 2015 10:39:09 +0100 Subject: [PATCH 3/3] fixup! Derive Copy for js::Class. --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 6e6becea7..283f2d60d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -149,6 +149,7 @@ pub struct Class { pub ops: ObjectOps, } +#[deriving(Copy)] pub struct ClassExtension { pub equality: *const u8, pub outerObject: Option, @@ -158,6 +159,7 @@ pub struct ClassExtension { pub isWrappedNative: *const u8, } +#[deriving(Copy)] pub struct ObjectOps { pub lookupGeneric: *const u8, pub lookupProperty: *const u8,