Skip to content

Commit

Permalink
fix: Remove Userdata and Trace impls for RwLock and Mutex
Browse files Browse the repository at this point in the history
With the mark/unmark use of Trace this can't be done safely. Wrappers
around these type will be added to fill the void
  • Loading branch information
Marwes committed Jun 26, 2019
1 parent 854a638 commit e90f02b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
2 changes: 0 additions & 2 deletions vm/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,6 @@ pub trait Pushable<'vm>: AsyncPushable<'vm> {
}
}

impl<T> Userdata for std::sync::RwLock<T> where T: Userdata {}

/// Trait which allows rust values to be retrieved from the virtual machine
pub trait Getable<'vm, 'value>: Sized {
type Proxy: 'value;
Expand Down
20 changes: 1 addition & 19 deletions vm/src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{
ptr::{self, NonNull},
rc::Rc,
result::Result as StdResult,
sync::{Arc, Mutex, RwLock},
sync::Arc,
};

use crate::base::fnv::FnvMap;
Expand Down Expand Up @@ -598,24 +598,6 @@ where
}
}

unsafe impl<T> Trace for Mutex<T>
where
T: Trace,
{
impl_trace! { self, gc,
mark(&*self.lock().unwrap(), gc)
}
}

unsafe impl<T> Trace for RwLock<T>
where
T: Trace,
{
impl_trace! { self, gc,
mark(&*self.read().unwrap(), gc)
}
}

unsafe impl<T: ?Sized> Trace for PhantomData<T> {
impl_trace! { self, _gc, {} }
}
Expand Down

0 comments on commit e90f02b

Please sign in to comment.