aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2015-11-08 12:51:00 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2015-11-08 12:51:00 +0530
commit92f9e58310f1b7c3925882979ae9352967866b66 (patch)
tree49e60ce7d64316c12514cfe02b7bb602507c1706 /components/script/script_task.rs
parentcd0c8c4e41e9601975c3e8023b36cd66c4ee6b71 (diff)
parent1a50fce67c840123447c9949c9692f4bb5828e5d (diff)
downloadservo-92f9e58310f1b7c3925882979ae9352967866b66.tar.gz
servo-92f9e58310f1b7c3925882979ae9352967866b66.zip
Auto merge of #8286 - eefriedman:no-move, r=nox
Remove unnecessary uses of #[no_move] The patch makes RootCollection a bit safer by making the StackRootTLS hold it in place. RootedVec was doing an extremely delicate dance and just hoping nobody messed it up; switch to a Box to be safe. CodeGenRust seemed to be using no_move for no particularly good reason. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8286) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index f9919637457..28e194b2a4a 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -90,6 +90,7 @@ use std::borrow::ToOwned;
use std::cell::{Cell, RefCell};
use std::collections::HashSet;
use std::io::{Write, stdout};
+use std::marker::PhantomData;
use std::mem as std_mem;
use std::option::Option;
use std::ptr;
@@ -367,18 +368,18 @@ impl TimerEventChan for MainThreadTimerEventChan {
}
}
-pub struct StackRootTLS;
+pub struct StackRootTLS<'a>(PhantomData<&'a u32>);
-impl StackRootTLS {
- pub fn new(roots: &RootCollection) -> StackRootTLS {
+impl<'a> StackRootTLS<'a> {
+ pub fn new(roots: &'a RootCollection) -> StackRootTLS<'a> {
STACK_ROOTS.with(|ref r| {
r.set(Some(RootCollectionPtr(roots as *const _)))
});
- StackRootTLS
+ StackRootTLS(PhantomData)
}
}
-impl Drop for StackRootTLS {
+impl<'a> Drop for StackRootTLS<'a> {
fn drop(&mut self) {
STACK_ROOTS.with(|ref r| r.set(None));
}