Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19.

This commit is contained in:
Ms2ger 2015-01-02 12:45:28 +01:00 committed by Josh Matthews
parent cf616b90a2
commit 16c7060bc8
153 changed files with 2095 additions and 1298 deletions

View file

@ -70,6 +70,15 @@ pub struct Temporary<T> {
_js_ptr: *mut JSObject,
}
impl<T> Clone for Temporary<T> {
fn clone(&self) -> Temporary<T> {
Temporary {
inner: self.inner,
_js_ptr: self._js_ptr,
}
}
}
impl<T> PartialEq for Temporary<T> {
fn eq(&self, other: &Temporary<T>) -> bool {
self.inner == other.inner
@ -92,10 +101,12 @@ impl<T: Reflectable> Temporary<T> {
/// Create a stack-bounded root for this value.
pub fn root(self) -> Root<T> {
let collection = StackRoots.get().unwrap();
unsafe {
Root::new(&**collection, &self.inner)
}
StackRoots.with(|ref collection| {
let RootCollectionPtr(collection) = collection.get().unwrap();
unsafe {
Root::new(&*collection, &self.inner)
}
})
}
unsafe fn inner(&self) -> JS<T> {
@ -114,6 +125,8 @@ pub struct JS<T> {
ptr: *const T
}
impl<T> Copy for JS<T> {}
impl<T> PartialEq for JS<T> {
#[allow(unrooted_must_root)]
fn eq(&self, other: &JS<T>) -> bool {
@ -151,10 +164,12 @@ impl<T: Reflectable> JS<T> {
/// Root this JS-owned value to prevent its collection as garbage.
pub fn root(&self) -> Root<T> {
let collection = StackRoots.get().unwrap();
unsafe {
Root::new(&**collection, self)
}
StackRoots.with(|ref collection| {
let RootCollectionPtr(collection) = collection.get().unwrap();
unsafe {
Root::new(&*collection, self)
}
})
}
}
@ -270,7 +285,7 @@ impl<T: Reflectable> MutNullableJS<T> {
Some(inner) => inner,
None => {
let inner = cb();
self.assign(Some(inner));
self.assign(Some(inner.clone()));
inner
},
}
@ -450,6 +465,10 @@ pub struct RootCollection {
roots: UnsafeCell<SmallVec16<*mut JSObject>>,
}
pub struct RootCollectionPtr(pub *const RootCollection);
impl Copy for RootCollectionPtr {}
impl RootCollection {
/// Create an empty collection of roots
pub fn new() -> RootCollection {
@ -548,6 +567,8 @@ pub struct JSRef<'a, T> {
chain: ContravariantLifetime<'a>,
}
impl<'a, T> Copy for JSRef<'a, T> {}
impl<'a, T> Clone for JSRef<'a, T> {
fn clone(&self) -> JSRef<'a, T> {
JSRef {