Repository navigation
Deprecate into_vec and into_boxed_slice in favor of Into - #685
Conversation
Signed-off-by: Ashutosh Panda <133190480+Ashutosh-Panda2004@users.noreply.github.com>
Replaced the implementation of `into_vec` and `into_boxed_slice` to use `Into::into` instead of custom logic. Signed-off-by: Ashutosh Panda <133190480+Ashutosh-Panda2004@users.noreply.github.com>
Signed-off-by: Ashutosh Panda <133190480+Ashutosh-Panda2004@users.noreply.github.com>
…methods-1 Refactor deprecated methods to use Into::into
…methods-2 Update assertions in into_vec test for SmallVec
|
@alejandro-vaz, this is ready for review whenever you have a moment. |
alejandro-vaz
left a comment
There was a problem hiding this comment.
okay for it to work properly I realized we have to change the implementations to use SmallVec<T, N, A> I think
|
honestly, everywhere in the codebase we should be using |
Signed-off-by: Ashutosh Panda <133190480+Ashutosh-Panda2004@users.noreply.github.com>
Ashutosh-Panda2004
left a comment
There was a problem hiding this comment.
Addressed the From implementations are now generic over A: Allocator.
Agreed , I'll do the codebase-wide pass in #686 so this PR stays focused. |
|
you have to run |
Remove extra newline before the deprecated function. Signed-off-by: Ashutosh Panda <133190480+Ashutosh-Panda2004@users.noreply.github.com>
Signed-off-by: Ashutosh Panda <133190480+Ashutosh-Panda2004@users.noreply.github.com>
Ashutosh-Panda2004
left a comment
There was a problem hiding this comment.
Formatting fixed, removed the double blank line in src/lib.rs and shortened the long SAFETY comment in src/conversions.rs to fit the 100-char limit. Should be rustfmt-clean now, waiting on CI.
Clarify safety comments regarding vector ownership transfer. Signed-off-by: Ashutosh Panda <133190480+Ashutosh-Panda2004@users.noreply.github.com>
Signed-off-by: Ashutosh Panda <133190480+Ashutosh-Panda2004@users.noreply.github.com>
Signed-off-by: Ashutosh Panda <133190480+Ashutosh-Panda2004@users.noreply.github.com>
Ashutosh-Panda2004
left a comment
There was a problem hiding this comment.
Fix rustfmt formatting issues
|
@alejandro-vaz Formatting is fixed now, the two deprecated attributes are on single lines and the conversions.rs bits are cleaned up. CI is green on the latest push, could you take another look when you get a chance? |
| since = "2.0.0-alpha.13", | ||
| note = "use `TryInto::<[T; N]>::try_into` instead" | ||
| )] | ||
|
|
There was a problem hiding this comment.
but this can be removed
|
|
||
| #[inline] | ||
| #[deprecated(since = "2.0.0", note = "use `Into::<Vec<T>>::into` instead")] | ||
|
|
There was a problem hiding this comment.
why did you add it?? rustfmt doesn't require it
Remove deprecated methods and update notes for alternatives. Signed-off-by: Ashutosh Panda <133190480+Ashutosh-Panda2004@users.noreply.github.com>
|
@alejandro-vaz Removed the blank lines between the deprecated attributes and the three functions. Should be good now. |
|
thanks brother |
| // - the allocation is not larger than `isize::MAX` | ||
| unsafe { | ||
| let (ptr, cap) = this.raw.heap; | ||
| Vec::from_raw_parts(ptr.as_ptr(), length, cap) |
There was a problem hiding this comment.
Isn't it unsound to create a Vec<T, Global> from memory allocated by A?
From the from_raw_parts docs:
If
Tis not a zero-sized type and the capacity is nonzero,ptrmust have been allocated using the global allocator, such as via thealloc::allocfunction.
Moves the conversion logic into the existing
From<SmallVec<T, N>>impls forVec<T>andBox<[T]>, and turnsinto_vec/into_boxed_sliceinto deprecated compatibility wrappers delegating toInto.Closes #683.