diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 1 | ||||
-rw-r--r-- | components/script/dom/bindings/js.rs | 1 | ||||
-rw-r--r-- | components/script/dom/bindings/mod.rs | 4 | ||||
-rw-r--r-- | components/script/dom/bindings/trace.rs | 32 |
4 files changed, 19 insertions, 19 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 9348a198ef0..8e88b5cb2e1 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -4927,7 +4927,6 @@ class CGDictionary(CGThing): for m in self.memberInfo] return (string.Template( - "#[no_move]\n" + "pub struct ${selfName} {\n" + "${inheritance}" + "\n".join(memberDecls) + "\n" + diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index 8cae3f82618..3aceb11f113 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -454,7 +454,6 @@ impl<T: Reflectable> OptionalRootedReference<T> for Option<Option<Root<T>>> { /// /// See also [*Exact Stack Rooting - Storing a GCPointer on the CStack*] /// (https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Internals/GC/Exact_Stack_Rooting). -#[no_move] pub struct RootCollection { roots: UnsafeCell<Vec<*const Reflector>>, } diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs index f4b795f8c58..410f7af9dda 100644 --- a/components/script/dom/bindings/mod.rs +++ b/components/script/dom/bindings/mod.rs @@ -152,9 +152,7 @@ pub mod xmlname; /// Generated JS-Rust bindings. #[allow(missing_docs, non_snake_case)] pub mod codegen { - // FIXME(#5853) we shouldn't need to - // allow moved_no_move here - #[allow(unrooted_must_root, moved_no_move)] + #[allow(unrooted_must_root)] pub mod Bindings { include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs")); } diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 48f6ed39032..5d4e0a603f5 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -382,7 +382,7 @@ impl RootedTraceableSet { } } - fn remove<T: JSTraceable>(traceable: &T) { + unsafe fn remove<T: JSTraceable>(traceable: &T) { ROOTED_TRACEABLES.with(|ref traceables| { let mut traceables = traceables.borrow_mut(); let idx = @@ -395,7 +395,7 @@ impl RootedTraceableSet { }); } - fn add<T: JSTraceable>(traceable: &T) { + unsafe fn add<T: JSTraceable>(traceable: &T) { ROOTED_TRACEABLES.with(|ref traceables| { fn trace<T: JSTraceable>(obj: *const libc::c_void, tracer: *mut JSTracer) { let obj: &T = unsafe { &*(obj as *const T) }; @@ -432,14 +432,18 @@ pub struct RootedTraceable<'a, T: 'a + JSTraceable> { impl<'a, T: JSTraceable> RootedTraceable<'a, T> { /// Root a JSTraceable thing for the life of this RootedTraceable pub fn new(traceable: &'a T) -> RootedTraceable<'a, T> { - RootedTraceableSet::add(traceable); + unsafe { + RootedTraceableSet::add(traceable); + } RootedTraceable { ptr: traceable } } } impl<'a, T: JSTraceable> Drop for RootedTraceable<'a, T> { fn drop(&mut self) { - RootedTraceableSet::remove(self.ptr); + unsafe { + RootedTraceableSet::remove(self.ptr); + } } } @@ -461,15 +465,13 @@ impl<T: JSTraceable> RootedVec<T> { return_address() as *const libc::c_void }; - RootedVec::new_with_destination_address(addr) + unsafe { RootedVec::new_with_destination_address(addr) } } /// Create a vector of items of type T. This constructor is specific /// for RootTraceableSet. - pub fn new_with_destination_address(addr: *const libc::c_void) -> RootedVec<T> { - unsafe { - RootedTraceableSet::add::<RootedVec<T>>(&*(addr as *const _)); - } + pub unsafe fn new_with_destination_address(addr: *const libc::c_void) -> RootedVec<T> { + RootedTraceableSet::add::<RootedVec<T>>(&*(addr as *const _)); RootedVec::<T> { v: vec!() } } } @@ -477,13 +479,15 @@ impl<T: JSTraceable> RootedVec<T> { impl<T: JSTraceable + Reflectable> RootedVec<JS<T>> { /// Obtain a safe slice of references that can't outlive that RootedVec. pub fn r(&self) -> &[&T] { - unsafe { mem::transmute(&*self.v) } + unsafe { mem::transmute(&self.v[..]) } } } impl<T: JSTraceable> Drop for RootedVec<T> { fn drop(&mut self) { - RootedTraceableSet::remove(self); + unsafe { + RootedTraceableSet::remove(self); + } } } @@ -503,9 +507,9 @@ impl<T: JSTraceable> DerefMut for RootedVec<T> { impl<A: JSTraceable + Reflectable> FromIterator<Root<A>> for RootedVec<JS<A>> { #[allow(moved_no_move)] fn from_iter<T>(iterable: T) -> RootedVec<JS<A>> where T: IntoIterator<Item=Root<A>> { - let mut vec = RootedVec::new_with_destination_address(unsafe { - return_address() as *const libc::c_void - }); + let mut vec = unsafe { + RootedVec::new_with_destination_address(return_address() as *const libc::c_void) + }; vec.extend(iterable.into_iter().map(|item| JS::from_rooted(&item))); vec } |