servo: Merge #8286 - Remove unnecessary uses of #[no_move] (from eefriedman:no-move); r=nox
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. Source-Repo: https://github.com/servo/servo Source-Revision: 92f9e58310f1b7c3925882979ae9352967866b66
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user