Update Rust.

This commit is contained in:
Ms2ger 2014-05-08 23:40:15 +02:00 committed by Jack Moffitt
parent 3644d0272c
commit eaedeb07cb
184 changed files with 643 additions and 657 deletions

View file

@ -49,7 +49,6 @@ use script_task::StackRoots;
use std::cast;
use std::cell::RefCell;
use std::kinds::marker::ContravariantLifetime;
use std::local_data;
/// A type that represents a JS-owned value that is rooted for the lifetime of this value.
/// Importantly, it requires explicit rooting in order to interact with the inner value.
@ -94,12 +93,10 @@ impl<T: Reflectable> Temporary<T> {
/// Create a stack-bounded root for this value.
pub fn root<'a, 'b>(self) -> Root<'a, 'b, T> {
local_data::get(StackRoots, |opt| {
let collection = opt.unwrap();
unsafe {
(**collection).new_root(&self.inner)
}
})
let collection = StackRoots.get().unwrap();
unsafe {
(**collection).new_root(&self.inner)
}
}
unsafe fn inner(&self) -> JS<T> {
@ -162,12 +159,10 @@ impl<T: Reflectable> JS<T> {
/// Root this JS-owned value to prevent its collection as garbage.
pub fn root<'a, 'b>(&self) -> Root<'a, 'b, T> {
local_data::get(StackRoots, |opt| {
let collection = opt.unwrap();
unsafe {
(**collection).new_root(self)
}
})
let collection = StackRoots.get().unwrap();
unsafe {
(**collection).new_root(self)
}
}
}