Skip to content

allocator: Vec::into_boxed_slice does not return our Box #6193

@DonIsaac

Description

@DonIsaac

Vec::into_boxed_slice returns an allocator_api2::stable::boxed::Box, which is not assignable to oxc_allocator::boxed::Box

Add this test case to vec.rs to reproduce.

#[test]
fn test_vec_to_boxed_slice() {
    // file: oxc_allocator/src/vec.rs
    use crate::boxed::Box;

    let allocator = Allocator::default();
    let v = Vec::from_iter_in([1,2,3], &allocator);
    let b: Box<[i32]> = v.into_boxed_slice(); // <- compiler error
    assert_eq!(&*b, &[1, 2, 3]);
}

Metadata

Metadata

Assignees

Labels

C-bugCategory - Bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions