servo / servo/rust-smallvec

fix allocator API `into_boxed_slice` and `into_vec`

Open Beginner friendly
#632 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.7k
Forks
216
Avg merge
17h 50m
Merged PRs (30d)
95

Description

    #[inline]
    pub fn into_boxed_slice(self) -> Box<[T]> {
        self.into_vec().into_boxed_slice()
    }

and also

pub fn into_vec(self) -> Vec<T> {

Both are UBs.

Whoops, I thought I left all the stdlib-interacting functions only implemented for SmallVec<_, Global> (from_vec is correct).

Originally posted by @bolshoytoster in https://github.com/servo/rust-smallvec/issues/630#issuecomment-5744461318

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the into_boxed_slice and into_vec entry points and tracing how each handles non-Global allocators. Done means both APIs no longer have undefined behavior for the allocator cases covered by this issue, with the relevant tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.