From 42c7d920ddfc346fc7ed90e005d2abaf740c9996 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 10 Apr 2014 22:17:01 +0200 Subject: [PATCH 1/2] Update to current rust: use the new attributes syntax. --- global.rs | 4 ++-- js.rc | 20 +++++++++----------- jsapi.rs | 2 +- rust.rs | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/global.rs b/global.rs index 4d97a99f5..ec7e5a80d 100644 --- a/global.rs +++ b/global.rs @@ -2,11 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#[doc = " +#![doc = " Handy functions for creating class objects and so forth. -"]; +"] use std::libc::{c_uint, c_void}; use std::str::raw::from_c_str; diff --git a/js.rc b/js.rc index 8394a7249..6f8c9085d 100644 --- a/js.rc +++ b/js.rc @@ -2,22 +2,20 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#[crate_id = "github.com/mozilla-servo/rust-mozjs#js:0.1"]; -#[crate_type = "lib"]; -#[crate_type = "dylib"]; -#[crate_type = "rlib"]; +#![crate_id = "github.com/mozilla-servo/rust-mozjs#js:0.1"] +#![crate_type = "lib"] +#![crate_type = "dylib"] +#![crate_type = "rlib"] -#[feature(globs, link_args, managed_boxes)]; +#![feature(globs, link_args, managed_boxes, phase)] -#[allow(non_uppercase_statics, non_camel_case_types)]; - -#[feature(phase)]; -#[phase(syntax, link)] extern crate log; +#![allow(non_uppercase_statics, non_camel_case_types)] +extern crate green; +#[phase(syntax, link)] +extern crate log; #[cfg(test)] extern crate rustuv; - -extern crate green; extern crate serialize; use std::cast; diff --git a/jsapi.rs b/jsapi.rs index 491e46f28..9ad227826 100644 --- a/jsapi.rs +++ b/jsapi.rs @@ -4,7 +4,7 @@ /* automatically generated by rust-bindgen */ -#[allow(non_uppercase_statics, non_camel_case_types)]; +#![allow(non_uppercase_statics, non_camel_case_types)] use std::libc::*; use jsfriendapi::JSJitInfo; diff --git a/rust.rs b/rust.rs index 70b8514e6..bd4f43e74 100644 --- a/rust.rs +++ b/rust.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#[doc = "Rust wrappers around the raw JS apis"]; +#![doc = "Rust wrappers around the raw JS apis"] use std::libc::types::os::arch::c95::{size_t, c_uint}; use std::libc::c_char; From c78021fa726d5609d15062393ab55bfd8e16259a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 10 Apr 2014 22:17:31 +0200 Subject: [PATCH 2/2] Update to current rust: libc is in its own crate. --- global.rs | 2 +- glue.rs | 4 ++-- js.rc | 5 +++-- jsapi.rs | 2 +- jsfriendapi.rs | 2 +- jsval.rs | 2 +- rust.rs | 4 ++-- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/global.rs b/global.rs index ec7e5a80d..adcbd70b5 100644 --- a/global.rs +++ b/global.rs @@ -8,7 +8,7 @@ Handy functions for creating class objects and so forth. "] -use std::libc::{c_uint, c_void}; +use libc::{c_uint, c_void}; use std::str::raw::from_c_str; use std::cast::transmute; use std::ptr::null; diff --git a/glue.rs b/glue.rs index aa6709ada..aa48d9433 100644 --- a/glue.rs +++ b/glue.rs @@ -4,8 +4,8 @@ /* automatically generated by rust-bindgen */ -use std::libc; -use std::libc::*; +use libc; +use libc::*; use jsapi::*; use jsfriendapi::JSJitInfo; use jsval::JSVal; diff --git a/js.rc b/js.rc index 6f8c9085d..6524d24a0 100644 --- a/js.rc +++ b/js.rc @@ -12,21 +12,22 @@ #![allow(non_uppercase_statics, non_camel_case_types)] extern crate green; +extern crate libc; #[phase(syntax, link)] extern crate log; #[cfg(test)] extern crate rustuv; extern crate serialize; +use libc::c_uint; +use libc::types::common::c99::uint32_t; use std::cast; use std::ptr::null; use std::result::{Result, Ok, Err}; -use std::libc::c_uint; use jsapi::{JSBool, JSContext, JSObject, jsid, JSProto_LIMIT}; use jsapi::JS_ComputeThis; -use std::libc::types::common::c99::uint32_t; use jsval::JSVal; use rust::jsobj; diff --git a/jsapi.rs b/jsapi.rs index 9ad227826..48343969f 100644 --- a/jsapi.rs +++ b/jsapi.rs @@ -6,7 +6,7 @@ #![allow(non_uppercase_statics, non_camel_case_types)] -use std::libc::*; +use libc::*; use jsfriendapi::JSJitInfo; use jsval::JSVal; diff --git a/jsfriendapi.rs b/jsfriendapi.rs index a16b0f91e..e051edcb4 100644 --- a/jsfriendapi.rs +++ b/jsfriendapi.rs @@ -17,7 +17,7 @@ pub struct JSJitInfo { #[nolink] pub mod bindgen { use jsapi::{JSContext, JSObject, JSClass, JSRuntime}; - use std::libc::uintptr_t; + use libc::uintptr_t; extern { pub fn JS_NewObjectWithUniqueType(cx: *JSContext, clasp: *JSClass, diff --git a/jsval.rs b/jsval.rs index a58a4190d..caf36b241 100644 --- a/jsval.rs +++ b/jsval.rs @@ -4,8 +4,8 @@ use jsapi::{JSObject, JSString}; +use libc::c_void; use std::cast; -use std::libc::c_void; static JSVAL_TAG_SHIFT: int = 47; diff --git a/rust.rs b/rust.rs index bd4f43e74..53c0ab740 100644 --- a/rust.rs +++ b/rust.rs @@ -4,8 +4,8 @@ #![doc = "Rust wrappers around the raw JS apis"] -use std::libc::types::os::arch::c95::{size_t, c_uint}; -use std::libc::c_char; +use libc::types::os::arch::c95::{size_t, c_uint}; +use libc::c_char; use std::cmp; use std::rc; use std::rt::Runtime;