Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conversions: Implement FromJSValConvertible for Vec<T> #226

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Remove Rooted<T> drop flag

This actually works, even though it feels too hacky...
  • Loading branch information
emilio committed Dec 30, 2015
commit 21b6f4f5085589132caf889d9cee58bfcf7fefcd
@@ -659,6 +659,7 @@ pub struct InternalHandle<T> {
pub _phantom0: PhantomData<T>,
}
#[repr(C)]
#[unsafe_no_drop_flag]
pub struct Rooted<T> {
pub _base: RootedBase<T>,
pub stack: *mut *mut Rooted<*mut ::libc::c_void>,
@@ -659,6 +659,7 @@ pub struct InternalHandle<T> {
pub _phantom0: PhantomData<T>,
}
#[repr(C)]
#[unsafe_no_drop_flag]
pub struct Rooted<T> {
pub _base: RootedBase<T>,
pub stack: *mut *mut Rooted<*mut ::libc::c_void>,
@@ -659,6 +659,7 @@ pub struct InternalHandle<T> {
pub _phantom0: PhantomData<T>,
}
#[repr(C)]
#[unsafe_no_drop_flag]
pub struct Rooted<T> {
pub _base: RootedBase<T>,
pub stack: *mut *mut Rooted<*mut ::libc::c_void>,
@@ -659,6 +659,7 @@ pub struct InternalHandle<T> {
pub _phantom0: PhantomData<T>,
}
#[repr(C)]
#[unsafe_no_drop_flag]
pub struct Rooted<T> {
pub _base: RootedBase<T>,
pub stack: *mut *mut Rooted<*mut ::libc::c_void>,
@@ -10,6 +10,7 @@
#![feature(str_utf16)]
#![feature(unsafe_no_drop_flag)]
#![feature(const_fn)]
#![feature(filling_drop)]

#![allow(non_upper_case_globals, non_camel_case_types, non_snake_case, improper_ctypes, raw_pointer_derive)]

@@ -328,16 +328,23 @@ impl<T: Copy> MutableHandle<T> {
}
}

/*
impl<T> Drop for Rooted<T> {
fn drop(&mut self) {
unsafe {
// Since we use no drop flags, we must check for a dropped value
// manually.
//
// see: https://github.com/rust-lang/rust/blob/master/src/libcore/mem.rs
if self.stack == mem::dropped::<*mut _>() &&
self.prev == mem::dropped::<*mut _> () {
return
}

assert!(*self.stack == mem::transmute(&*self));
*self.stack = self.prev;
}
}
}
*/

impl CustomAutoRooter {
pub fn new(cx: *mut JSContext, vftable: &'static _vftable_CustomAutoRooter)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.