Skip to content

correct From<SmallVec<T, N, A>> for Box<[T]> implementation #714

Description

@alejandro-vaz

the current implementation on conversions.rs:

impl<T, const N: usize, A: Allocator> From<SmallVec<T, N, A>> for Box<[T]> {
    fn from(this: SmallVec<T, N, A>) -> Self {
        Vec::from(this).into_boxed_slice()
    }
}

first converts it to a Vec and changes the allocator before converting it into a box in Global

the correct implementation should preserve the allocator and not make use of an intermediary Vec:

impl<T, const N: usize, A: Allocator> From<SmallVec<T, N, A>> for Box<[T], A>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for a first contributorhelp wantedNo clear candidate to implement itr-featurerelated to a new feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions