Skip to content

feat(allocator)!: remove Vec::into_boxed_slice method#9735

Merged
graphite-app[bot] merged 1 commit intomainfrom
03-13-feat_allocator_remove_vec_into_boxed_slice_method
Mar 13, 2025
Merged

feat(allocator)!: remove Vec::into_boxed_slice method#9735
graphite-app[bot] merged 1 commit intomainfrom
03-13-feat_allocator_remove_vec_into_boxed_slice_method

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Mar 13, 2025

related: #9656 (comment)

This method blocks us from replacing the allocator-api2's Vec with our own Vec(now called Vec2) in #9656, considering no use cases for this method, just remove it instead. After our own Vec is feature-complete, we can consider making

/*
#[cfg(feature = "boxed")]
impl<'bump, T> Vec<'bump, T> {
/// Converts the vector into [`Box<[T]>`][owned slice].
///
/// Note that this will drop any excess capacity.
///
/// [owned slice]: ../../boxed/struct.Box.html
///
/// # Examples
///
/// ```
/// use bumpalo::{Bump, collections::Vec, vec};
///
/// let b = Bump::new();
///
/// let v = vec![in &b; 1, 2, 3];
///
/// let slice = v.into_boxed_slice();
/// ```
pub fn into_boxed_slice(mut self) -> crate::boxed::Box<'bump, [T]> {
use crate::boxed::Box;
// Unlike `alloc::vec::Vec` shrinking here isn't necessary as `bumpalo::boxed::Box` doesn't own memory.
unsafe {
let slice = slice::from_raw_parts_mut(self.as_mut_ptr(), self.len);
let output: Box<'bump, [T]> = Box::from_raw(slice);
mem::forget(self);
output
}
}
}
*/
this work.

@github-actions github-actions bot added the C-enhancement Category - New feature or request label Mar 13, 2025
Copy link
Member Author

Dunqing commented Mar 13, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Dunqing Dunqing force-pushed the 03-13-feat_allocator_remove_vec_into_boxed_slice_method branch from b32469a to 0c0a644 Compare March 13, 2025 03:48
@Dunqing Dunqing requested a review from overlookmotel March 13, 2025 03:49
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 13, 2025

CodSpeed Performance Report

Merging #9735 will not alter performance

Comparing 03-13-feat_allocator_remove_vec_into_boxed_slice_method (f2b0cc1) with main (65d9662)

Summary

✅ 33 untouched benchmarks

@overlookmotel overlookmotel changed the title feat(allocator): remove Vec::into_boxed_slice method feat(allocator)!: remove Vec::into_boxed_slice method Mar 13, 2025
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Mar 13, 2025
Copy link
Member

overlookmotel commented Mar 13, 2025

Merge activity

  • Mar 13, 12:17 AM EDT: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Mar 13, 12:18 AM EDT: A user added this pull request to the Graphite merge queue.
  • Mar 13, 12:23 AM EDT: A user merged this pull request with the Graphite merge queue.

related: #9656 (comment)

This method blocks us from replacing the allocator-api2's `Vec` with our own `Vec`(now called `Vec2`) in #9656, considering no use cases for this method, just remove it instead. After our own `Vec` is feature-complete, we can consider making https://github.com/oxc-project/oxc/blob/b32469a458b36097162e45c8ab20327d46867c7f/crates/oxc_allocator/src/vec2/mod.rs#L1686-L1719 this work.
@graphite-app graphite-app bot force-pushed the 03-13-feat_allocator_remove_vec_into_boxed_slice_method branch from 0c0a644 to f2b0cc1 Compare March 13, 2025 04:18
@graphite-app graphite-app bot merged commit f2b0cc1 into main Mar 13, 2025
26 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 13, 2025
@graphite-app graphite-app bot deleted the 03-13-feat_allocator_remove_vec_into_boxed_slice_method branch March 13, 2025 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants