mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
auto merge of #4575 : mttr/servo/warnings, r=jdm
Notes: * This adds `#![allow(missing_copy_implementations)]` to components/*/lib.rs. I'm not sure how to approach the missing Copy warnings (are there things for which Copy should NOT be implemented, and how can I tell?) so I stuck this in to make life easier when looking through the warnings. I can easily remove this if necessary. * This leaves the following type of warnings, which I couldn't figure out how to approach (I'll investigate it later if no one else wants to). ``` css/matching.rs:72:23: 72:35 warning: use of deprecated item: Use overloaded core::cmp::PartialEq, #[warn(deprecated)] on by default css/matching.rs:72 this_as_query.equiv(other) ^~~~~~~~~~~~ css/matching.rs:95:10: 95:49 warning: use of deprecated item: Use overloaded core::cmp::PartialEq, #[warn(deprecated)] on by default css/matching.rs:95 impl<'a> Equiv<ApplicableDeclarationsCacheEntry> for ApplicableDeclarationsCacheQuery<'a> { ```
This commit is contained in:
commit
0793137631
36 changed files with 88 additions and 74 deletions
|
@ -272,9 +272,8 @@ pub fn jsstring_to_str(cx: *mut JSContext, s: *mut JSString) -> DOMString {
|
|||
unsafe {
|
||||
let mut length = 0;
|
||||
let chars = JS_GetStringCharsAndLength(cx, s, &mut length);
|
||||
slice::raw::buf_as_slice(chars, length as uint, |char_vec| {
|
||||
String::from_utf16(char_vec).unwrap()
|
||||
})
|
||||
let char_vec = slice::from_raw_buf(&chars, length as uint);
|
||||
String::from_utf16(char_vec).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,14 +327,14 @@ impl FromJSValConvertible<()> for ByteString {
|
|||
|
||||
let mut length = 0;
|
||||
let chars = JS_GetStringCharsAndLength(cx, string, &mut length);
|
||||
slice::raw::buf_as_slice(chars, length as uint, |char_vec| {
|
||||
if char_vec.iter().any(|&c| c > 0xFF) {
|
||||
// XXX Throw
|
||||
Err(())
|
||||
} else {
|
||||
Ok(ByteString::new(char_vec.iter().map(|&c| c as u8).collect()))
|
||||
}
|
||||
})
|
||||
let char_vec = slice::from_raw_buf(&chars, length as uint);
|
||||
|
||||
if char_vec.iter().any(|&c| c > 0xFF) {
|
||||
// XXX Throw
|
||||
Err(())
|
||||
} else {
|
||||
Ok(ByteString::new(char_vec.iter().map(|&c| c as u8).collect()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ use dom::node::Node;
|
|||
use js::jsapi::JSObject;
|
||||
use js::jsval::JSVal;
|
||||
use layout_interface::TrustedNodeAddress;
|
||||
use script_task::StackRoots;
|
||||
use script_task::STACK_ROOTS;
|
||||
|
||||
use servo_util::smallvec::{SmallVec, SmallVec16};
|
||||
use std::cell::{Cell, UnsafeCell};
|
||||
|
@ -101,7 +101,7 @@ impl<T: Reflectable> Temporary<T> {
|
|||
|
||||
/// Create a stack-bounded root for this value.
|
||||
pub fn root(self) -> Root<T> {
|
||||
StackRoots.with(|ref collection| {
|
||||
STACK_ROOTS.with(|ref collection| {
|
||||
let RootCollectionPtr(collection) = collection.get().unwrap();
|
||||
unsafe {
|
||||
Root::new(&*collection, &self.inner)
|
||||
|
@ -164,7 +164,7 @@ impl<T: Reflectable> JS<T> {
|
|||
|
||||
/// Root this JS-owned value to prevent its collection as garbage.
|
||||
pub fn root(&self) -> Root<T> {
|
||||
StackRoots.with(|ref collection| {
|
||||
STACK_ROOTS.with(|ref collection| {
|
||||
let RootCollectionPtr(collection) = collection.get().unwrap();
|
||||
unsafe {
|
||||
Root::new(&*collection, self)
|
||||
|
|
|
@ -36,7 +36,7 @@ use std::collections::hash_map::{HashMap, Vacant, Occupied};
|
|||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
thread_local!(pub static LiveReferences: Rc<RefCell<Option<LiveDOMReferences>>> = Rc::new(RefCell::new(None)))
|
||||
thread_local!(pub static LIVE_REFERENCES: Rc<RefCell<Option<LiveDOMReferences>>> = Rc::new(RefCell::new(None)))
|
||||
|
||||
|
||||
/// A safe wrapper around a raw pointer to a DOM object that can be
|
||||
|
@ -57,7 +57,7 @@ impl<T: Reflectable> Trusted<T> {
|
|||
/// be prevented from being GCed for the duration of the resulting `Trusted<T>` object's
|
||||
/// lifetime.
|
||||
pub fn new(cx: *mut JSContext, ptr: JSRef<T>, script_chan: Box<ScriptChan + Send>) -> Trusted<T> {
|
||||
LiveReferences.with(|ref r| {
|
||||
LIVE_REFERENCES.with(|ref r| {
|
||||
let r = r.borrow();
|
||||
let live_references = r.as_ref().unwrap();
|
||||
let refcount = live_references.addref(cx, &*ptr as *const T);
|
||||
|
@ -74,7 +74,7 @@ impl<T: Reflectable> Trusted<T> {
|
|||
/// a different thread than the original value from which this `Trusted<T>` was
|
||||
/// obtained.
|
||||
pub fn to_temporary(&self) -> Temporary<T> {
|
||||
assert!(LiveReferences.with(|ref r| {
|
||||
assert!(LIVE_REFERENCES.with(|ref r| {
|
||||
let r = r.borrow();
|
||||
let live_references = r.as_ref().unwrap();
|
||||
self.owner_thread == (&*live_references) as *const _ as *const libc::c_void
|
||||
|
@ -123,7 +123,7 @@ pub struct LiveDOMReferences {
|
|||
impl LiveDOMReferences {
|
||||
/// Set up the task-local data required for storing the outstanding DOM references.
|
||||
pub fn initialize() {
|
||||
LiveReferences.with(|ref r| {
|
||||
LIVE_REFERENCES.with(|ref r| {
|
||||
*r.borrow_mut() = Some(LiveDOMReferences {
|
||||
table: RefCell::new(HashMap::new()),
|
||||
})
|
||||
|
@ -152,7 +152,7 @@ impl LiveDOMReferences {
|
|||
|
||||
/// Unpin the given DOM object if its refcount is 0.
|
||||
pub fn cleanup(cx: *mut JSContext, raw_reflectable: *const libc::c_void) {
|
||||
LiveReferences.with(|ref r| {
|
||||
LIVE_REFERENCES.with(|ref r| {
|
||||
let r = r.borrow();
|
||||
let live_references = r.as_ref().unwrap();
|
||||
let reflectable = raw_reflectable as *const Reflector;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue