Repository navigation
Conversation
|
lookin for feedback for the above pr @alejandro-vaz |
| const SPILLED_SIZE: usize = 100; | ||
|
|
||
| trait Vector<T>: for<'a> From<&'a [T]> + Extend<T> + FromIterator<T> { | ||
| /// A trait defining common vector operations, implemented by vectors taking items from a slice of lifetime 'slice. |
There was a problem hiding this comment.
remove the doc comment, we really aren't reading them at all
we will figure out in rc what doc comments we really need
| // Bounded `usize` between `0..=CAP` | ||
| impl<'a, const CAP: usize> Arbitrary<'a> for Bounded<usize, CAP> { | ||
| impl<'data, const CAP: usize> Arbitrary<'data> for Bounded<usize, CAP> { | ||
| /// Generates an arbitrary bounded usize value using the unstructured fuzzing data of lifetime 'data. |
| where T: Arbitrary<'data> | ||
| { | ||
| fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> { | ||
| /// Generates an arbitrary bounded vector by consuming items from the unstructured data stream of lifetime 'data. |
| fn splice_reserve_panic() { | ||
| struct CountDrop<'a>(&'a Cell<usize>); | ||
| /// A helper struct that increments a counter when dropped, bound to the cell's lifetime 'cell. | ||
| struct CountDrop<'cell>(&'cell Cell<usize>); |
There was a problem hiding this comment.
change this to 'valid
| struct DropCounter<'cell>(&'cell Cell<i32>); | ||
|
|
||
| impl<'a> Drop for DropCounter<'a> { | ||
| impl<'cell> Drop for DropCounter<'cell> { |
| #[test] | ||
| fn splice_reserve_panic() { | ||
| struct CountDrop<'a>(&'a Cell<usize>); | ||
| /// A helper struct that increments a counter when dropped, bound to the cell's lifetime 'cell. |
| #[test] | ||
| fn into_iter_drop() { | ||
| struct DropCounter<'a>(&'a Cell<i32>); | ||
| /// A helper struct that increments a counter when dropped, bound to the cell's lifetime 'cell. |
|
also half of the checks fail |
|
Ooh sorry for that I will to solve this fully by tomorrow morning and make sure every checks passes |
|
you there?? no pressure |
|
Yes sir I got a fever for 3 days |
|
hahahaha fair brother fair |
|
Hi @alejandro-vaz, I am here! I have addressed all your review comments: Removed the doc comments on Vector, Arbitrary implementations, and test helper structs. |
ff5d79a to
e18d381
Compare
|
conflicts to be solved now in the base allocator |
|
OK sir just 30 minutes I will solve this ci part |
e18d381 to
4f072ac
Compare
|
thanks @alejandro-vaz the above suggestion work successfuly |
alejandro-vaz
left a comment
There was a problem hiding this comment.
I'm wondering if any of the implementations indeed needs allocator support on specialization at all
| impl<Item, const INLINE: usize, Heap: Allocator + Default> Default | ||
| for SmallVec<Item, INLINE, Heap> | ||
| { | ||
| #[inline] | ||
| fn default() -> Self { | ||
| Self::new() | ||
| Self::new_in(Heap::default()) | ||
| } | ||
| } |
There was a problem hiding this comment.
this is wrong, no allocator support should be added here
default should always use the global allocator
| /// a separate implementation block for easy access whenever specialization is | ||
| /// disabled. | ||
| impl<Item, const INLINE: usize> SmallVec<Item, INLINE, Global> { | ||
| impl<Item, const INLINE: usize, Heap: Allocator + Default> SmallVec<Item, INLINE, Heap> { |
| unsafe fn from_elem_fallback(elem: Item, n: usize) -> Self | ||
| where Item: Clone { | ||
| let mut result = Self::new(); | ||
| let mut result = Self::new_in(Heap::default()); |
| unsafe fn from_slice_fallback(slice: &[Item]) -> Self | ||
| where Item: Clone { | ||
| let mut v = Self::new(); | ||
| let mut v = Self::new_in(Heap::default()); |
| } | ||
|
|
||
| impl<Item: Clone, const INLINE: usize> SpecFromElem<Item> for SmallVec<Item, INLINE, Global> { | ||
| impl<Item: Clone, const INLINE: usize, Heap: Allocator + Default> SpecFromElem<Item> |
| impl<Item: Copy, const INLINE: usize, Heap: Allocator + Default> SpecFromElem<Item> | ||
| for SmallVec<Item, INLINE, Heap> | ||
| { |
| { | ||
| unsafe fn spec_from_elem(elem: Item, n: usize) -> Self { | ||
| let mut result = Self::new(); | ||
| let mut result = Self::new_in(Heap::default()); |
| impl<Item: Clone, const INLINE: usize, Heap: Allocator + Default> SpecFromSlice<Item> | ||
| for SmallVec<Item, INLINE, Heap> | ||
| { |
| impl<Item: Copy, const INLINE: usize, Heap: Allocator + Default> SpecFromSlice<Item> | ||
| for SmallVec<Item, INLINE, Heap> | ||
| { |
| { | ||
| unsafe fn spec_from(slice: &[Item]) -> Self { | ||
| let mut v = Self::new(); | ||
| let mut v = Self::new_in(Heap::default()); |
|
Ok sir i will complete all the above feedback by the Eod |
|
Updated! Reverted |
|
well yeah... no files changed specialization didn't need allocator support now I'm realizing thanks @Ankit-cs for finding out |
|
OK @alejandro-vaz sir Finally it's completed |
Description
This PR addresses the allocator expansion task for
specialization.rs(#710).The following specialization traits have been updated to be generic over
Heap: Allocatorrather than being hardcoded to theGlobalallocator:SpecFromElem(for bothCloneandCopyitem implementations)SpecFromSlice(for bothCloneandCopyitem implementations)Note on
SpecFromIterator:As discussed in the main allocator tracking issue by
@bolshoytosterand@alejandro-vaz, expandingFromIteratorto custom allocators would awkwardly requireA: Allocator + Default. To stay consistent with standard library patterns,SpecFromIteratorwas intentionally left untouched and remains bound toGlobal.Related Issue
Fixes #710