From ee306aa62182778463487af278206a2b19a2b4c7 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Mon, 28 Oct 2013 20:08:55 -0700 Subject: [PATCH 1/2] fmt! -> format! --- global.rs | 8 ++++---- rust.rs | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/global.rs b/global.rs index 538c8970e..9f1325517 100644 --- a/global.rs +++ b/global.rs @@ -79,7 +79,7 @@ pub extern fn debug(cx: *JSContext, argc: c_uint, vp: *mut JSVal) -> JSBool { let argv = JS_ARGV(cx, &*vp); for i in range(0, argc as int) { let jsstr = JS_ValueToString(cx, *ptr::offset(argv, i)); - debug!("%s", jsval_to_rust_str(cx, jsstr)); + debug!("{:s}", jsval_to_rust_str(cx, jsstr)); } JS_SET_RVAL(cx, &*vp, JSVAL_VOID); return 1_i32; @@ -112,10 +112,10 @@ pub extern fn assert(cx: *JSContext, argc: c_uint, vp: *mut JSVal) -> JSBool { if result == 0 { // This operation can fail, but that is not critical. let source = JS_ValueToSource(cx, argument); - let msg = fmt!("JavaScript assertion failed: %s is falsy!", - jsval_to_rust_str(cx, source)); + let msg = format!("JavaScript assertion failed: {:s} is falsy!", + jsval_to_rust_str(cx, source)); - debug!(msg); + debug!("{:s}", msg); do msg.to_c_str().with_ref |buf| { JS_ReportError(cx, buf); } diff --git a/rust.rs b/rust.rs index 3e259a77b..63166d9ec 100644 --- a/rust.rs +++ b/rust.rs @@ -206,7 +206,7 @@ impl Cx { do script.to_utf16().as_imm_buf |script_ptr, script_len| { do filename.to_c_str().with_ref |filename_cstr| { let rval: JSVal = JSVAL_NULL; - debug!("Evaluating script from %s with content %?", filename, script); + debug!("Evaluating script from {:s} with content {}", filename, script); unsafe { if ERR == JS_EvaluateUCScript(self.ptr, glob.ptr, script_ptr, script_len as c_uint, @@ -227,7 +227,7 @@ impl Cx { pub fn lookup_class_name(@self, s: ~str) -> @JSClass { // FIXME: expect should really take a lambda... - let error_msg = fmt!("class %s not found in class table", s); + let error_msg = format!("class {:s} not found in class table", s); let name = self.classes.find(&s); *(name.expect(error_msg)) } @@ -259,7 +259,7 @@ pub extern fn reportError(_cx: *JSContext, msg: *c_char, report: *JSErrorReport) let fname = if fnptr.is_not_null() {from_c_str(fnptr)} else {~"none"}; let lineno = (*report).lineno; let msg = from_c_str(msg); - error!("Error at %s:%?: %s\n", fname, lineno, msg); + error!("Error at {:s}:{}: {:s}\n", fname, lineno, msg); } } @@ -330,8 +330,8 @@ impl Compartment { -> Result { let classptr = self.cx.lookup_class_name(class_name); let proto = self.global_protos.find(&proto_name.clone()).expect( - fmt!("new_object_with_proto: expected to find %s in the proto \ - table", proto_name)); + format!("new_object_with_proto: expected to find {:s} in the proto \ + table", proto_name)); unsafe { let obj = self.cx.rooted_obj(JS_NewObject(self.cx.ptr, ptr::to_unsafe_ptr(&*classptr), proto.ptr, parent)); From 38882711006b16d74583ad2770cff4f6140209e3 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Mon, 28 Oct 2013 20:41:37 -0700 Subject: [PATCH 2/2] Upgrade Rust --- js.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js.rc b/js.rc index 8f8e2dec6..80e174129 100644 --- a/js.rc +++ b/js.rc @@ -6,7 +6,7 @@ vers = "0.1")]; #[crate_type = "lib"]; -#[feature(globs)]; +#[feature(globs, managed_boxes)]; #[allow(non_uppercase_statics)];