Skip to content

Commit

Permalink
Fix SUSPICIOUS_AUTO_TRAIT_IMPLS
Browse files Browse the repository at this point in the history
  • Loading branch information
purpleposeidon committed Jul 30, 2022
1 parent 4876ff2 commit cc022cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl<M: TableMarker> From<Range<Id<M>>> for UncheckedIdRange<M> {
pub struct IdList<M: TableMarker> {
pub free: RunList<M>,
pushing: RunList<M>,
deleting: SyncRef<RunList<M>>,
deleting: SyncRef<M>,
outer_capacity: usize,
// We only use SyncRef because elsehwere needs a &mut V, but this is unusable.
}
Expand Down Expand Up @@ -603,7 +603,7 @@ impl<'a, M: TableMarker> IntoIterator for &'a IdList<M> {
}
pub struct ListRemoving<'a, M: TableMarker> {
checked: CheckedIter<'a, M>,
deleting: &'a SyncRef<RunList<M>>,
deleting: &'a SyncRef<M>,
// FIXME: Make it &mut Vec :(
}
impl<'a, M: TableMarker> Iterator for ListRemoving<'a, M> {
Expand Down
10 changes: 5 additions & 5 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use crate::table::TableMarker;

/// A `Sync`able `RefCell`.
#[derive(Default, Debug, Clone)]
pub struct SyncRef<T> {
val: RefCell<T>,
pub struct SyncRef<T: TableMarker> {
val: RefCell<RunList<T>>,
}
impl<T: TableMarker> SyncRef<RunList<T>> {
impl<T: TableMarker> SyncRef<T> {
pub fn new(val: RunList<T>) -> Self {
SyncRef {
val: RefCell::new(val),
Expand All @@ -25,8 +25,8 @@ impl<T: TableMarker> SyncRef<RunList<T>> {
}
}
// Trying to impl Deref/DerefMut provokes odd curiosities.
unsafe impl<T: TableMarker> Send for SyncRef<RunList<T>> {}
unsafe impl<T: TableMarker> Sync for SyncRef<RunList<T>> {}
unsafe impl<T: TableMarker> Send for SyncRef<T> {}
unsafe impl<T: TableMarker> Sync for SyncRef<T> {}
// FIXME: Ugh, this is probably unsound.

/// ```compile_fail
Expand Down

0 comments on commit cc022cf

Please sign in to comment.