Upgrade to Rust v1.49.0

This commit is contained in:
Michael Vines
2021-01-23 11:55:15 -08:00
parent 7604edb16f
commit cbffab7850
36 changed files with 156 additions and 132 deletions

View File

@ -89,18 +89,17 @@ impl<T: Clone + Default + Sized> Default for PinnedVec<T> {
}
}
impl<T: Clone + Default + Sized> Into<Vec<T>> for PinnedVec<T> {
fn into(mut self) -> Vec<T> {
if self.pinned {
unpin(self.x.as_mut_ptr());
self.pinned = false;
impl<T: Clone + Default + Sized> From<PinnedVec<T>> for Vec<T> {
fn from(mut pinned_vec: PinnedVec<T>) -> Self {
if pinned_vec.pinned {
unpin(pinned_vec.x.as_mut_ptr());
pinned_vec.pinned = false;
}
self.pinnable = false;
self.recycler = None;
std::mem::take(&mut self.x)
pinned_vec.pinnable = false;
pinned_vec.recycler = None;
std::mem::take(&mut pinned_vec.x)
}
}
pub struct PinnedIter<'a, T>(std::slice::Iter<'a, T>);
pub struct PinnedIterMut<'a, T>(std::slice::IterMut<'a, T>);

View File

@ -114,9 +114,12 @@ impl<T: Default + Reset> RecyclerX<T> {
let max_gc = self.stats.max_gc.load(Ordering::Relaxed);
if len > max_gc {
// this is not completely accurate, but for most cases should be fine.
self.stats
.max_gc
.compare_and_swap(max_gc, len, Ordering::Relaxed);
let _ = self.stats.max_gc.compare_exchange(
max_gc,
len,
Ordering::Relaxed,
Ordering::Relaxed,
);
}
let total = self.stats.total.load(Ordering::Relaxed);
let reuse = self.stats.reuse.load(Ordering::Relaxed);