From 14db6b53e0c582ef7a9f078e7b0eb7e4e84d59e4 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Mon, 21 Sep 2026 22:53:50 +0200 Subject: [PATCH 01/11] feat: new allocator features --- Cargo.toml | 3 ++- README.md | 5 ++-- src/allocator/base.rs | 55 +++++++++++++++++++++++++++++++++++++++ src/allocator/external.rs | 40 ++++++++++++++++++++++++++++ src/allocator/mod.rs | 41 +++++++++++++++++++++++++++++ src/allocator/native.rs | 40 ++++++++++++++++++++++++++++ src/conversions.rs | 4 +-- src/lib.rs | 26 ++++++++---------- src/rawsmallvec.rs | 4 +-- tests/main.rs | 14 +++++++--- 10 files changed, 206 insertions(+), 26 deletions(-) create mode 100644 src/allocator/base.rs create mode 100644 src/allocator/external.rs create mode 100644 src/allocator/mod.rs create mode 100644 src/allocator/native.rs diff --git a/Cargo.toml b/Cargo.toml index 258897f4..d579ebcc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,8 @@ debug = false strip = true [features] -default = ["allocator-api2"] +allocator-api = [] +allocator-api2 = ["dep:allocator-api2", "allocator-api"] internals = [] rayon = ["std", "dep:rayon"] serde = ["dep:serde_core"] diff --git a/README.md b/README.md index 46d34836..9e4a1a41 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,8 @@ v.sort(); ## Feature List -- `allocator-api2` (default enabled, nightly if disabled): uses the `allocator-api2` backend for the allocator API, otherwise it uses unstable alloc traits +- `allocator-api` (nightly): uses the `allocator-api` backend for the allocator API +- `allocator-api2`: uses the `allocator-api2` backend for the allocator API - `arbitrary`: implements `Arbitrary` for any `SmallVec` storing elements that implement `Arbitrary` - `borsh`: implements `BorshSerialize`, `BorshDeserialize` and `BorshSchema` - `bytes`: implements `BufMut` for SmallVec @@ -54,7 +55,6 @@ v.sort(); - `encase`: implements encasing as a runtime-sized array - `internals`: exports through the public API `TaggedLen` and `RawSmallVec` - `malloc_size_of`: implements `MallocSizeOf` and `MallocShallowSizeOf` -- `may_dangle` (nightly): enables the eyepatch optimization for dropping - `rayon`: implements parallel iteration - `serde`: implements serde's serialization and deserialization - `specialization` (nightly): enables specialization, improving performance on some cases @@ -62,5 +62,4 @@ v.sort(); > [!NOTE] > - SmallVec without any features enabled does not make use of the standard library. -> > - The `rayon` feature implicitly requires `std`. \ No newline at end of file diff --git a/src/allocator/base.rs b/src/allocator/base.rs new file mode 100644 index 00000000..758a5263 --- /dev/null +++ b/src/allocator/base.rs @@ -0,0 +1,55 @@ +pub use alloc::{ + boxed::Box, + vec::Vec +}; +use { + super::Allocator, + alloc::alloc::{ + alloc, + dealloc, + realloc + }, + core::{ + alloc::Layout, + ptr::NonNull + } +}; + +#[derive(Clone)] +pub struct Global; + +impl Allocator for Global { + #[inline] + fn allocate(&self, layout: Layout) -> Option> { + Some(NonNull::slice_from_raw_parts( + NonNull::new(unsafe { alloc(layout) })?, + layout.size() + )) + } + + #[inline] + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) -> () { + unsafe { dealloc(pointer.as_ptr(), layout) }; + } + + #[inline] + unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option> { + Some(NonNull::slice_from_raw_parts( + NonNull::new(unsafe { realloc(pointer.as_ptr(), old, new.size()) })?, + new.size() + )) + } + + #[inline] + unsafe fn shrink( + &self, + pointer: NonNull, + old: Layout, + new: Layout + ) -> Option> { + Some(NonNull::slice_from_raw_parts( + NonNull::new(unsafe { realloc(pointer.as_ptr(), old, new.size()) })?, + new.size() + )) + } +} diff --git a/src/allocator/external.rs b/src/allocator/external.rs new file mode 100644 index 00000000..458df581 --- /dev/null +++ b/src/allocator/external.rs @@ -0,0 +1,40 @@ +pub use allocator_api2::{ + alloc::Global, + boxed::Box, + vec::Vec +}; +use { + super::Allocator, + allocator_api2::alloc::Allocator as External, + core::{ + alloc::Layout, + ptr::NonNull + } +}; + +impl Allocator for Type { + #[inline] + fn allocate(&self, layout: Layout) -> Option> { + External::allocate(&self, layout).ok() + } + + #[inline] + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) -> () { + unsafe { External::deallocate(&self, pointer, layout) } + } + + #[inline] + unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option> { + unsafe { External::grow(&self, pointer, old, new).ok() } + } + + #[inline] + unsafe fn shrink( + &self, + pointer: NonNull, + old: Layout, + new: Layout + ) -> Option> { + unsafe { External::shrink(&self, pointer, old, new).ok() } + } +} diff --git a/src/allocator/mod.rs b/src/allocator/mod.rs new file mode 100644 index 00000000..ab50b041 --- /dev/null +++ b/src/allocator/mod.rs @@ -0,0 +1,41 @@ +#[cfg(not(feature = "allocator-api"))] +mod base; +#[cfg(feature = "allocator-api2")] +mod external; +#[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] +mod native; + +#[cfg(not(feature = "allocator-api"))] +pub use base::{ + Box, + Global, + Vec +}; +use core::{ + alloc::Layout, + ptr::NonNull +}; +#[cfg(feature = "allocator-api2")] +pub use external::{ + Box, + Global, + Vec +}; +#[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] +pub use native::{ + Box, + Global, + Vec +}; + +pub trait Allocator { + fn allocate(&self, layout: Layout) -> Option>; + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) -> (); + unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option>; + unsafe fn shrink( + &self, + pointer: NonNull, + old: Layout, + new: Layout + ) -> Option>; +} diff --git a/src/allocator/native.rs b/src/allocator/native.rs new file mode 100644 index 00000000..529bb55e --- /dev/null +++ b/src/allocator/native.rs @@ -0,0 +1,40 @@ +pub use alloc::{ + alloc::Global, + boxed::Box, + vec::Vec +}; +use { + super::Allocator, + alloc::alloc::Allocator as Native, + core::{ + alloc::Layout, + ptr::NonNull + } +}; + +impl Allocator for Type { + #[inline] + fn allocate(&self, layout: Layout) -> Option> { + Native::allocate(&self, layout).ok() + } + + #[inline] + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) -> () { + unsafe { Native::deallocate(&self, pointer, layout) } + } + + #[inline] + unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option> { + unsafe { Native::grow(&self, pointer, old, new).ok() } + } + + #[inline] + unsafe fn shrink( + &self, + pointer: NonNull, + old: Layout, + new: Layout + ) -> Option> { + unsafe { Native::shrink(&self, pointer, old, new).ok() } + } +} diff --git a/src/conversions.rs b/src/conversions.rs index 3e5bded8..335c8e9a 100644 --- a/src/conversions.rs +++ b/src/conversions.rs @@ -1,9 +1,9 @@ use { crate::{ Allocator, - SmallVec + SmallVec, + Vec }, - alloc::vec::Vec, core::{ mem::ManuallyDrop, ptr::copy_nonoverlapping diff --git a/src/lib.rs b/src/lib.rs index 5434d44f..7051c0c0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,10 +9,14 @@ #![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(feature = "specialization", allow(incomplete_features))] #![cfg_attr(feature = "specialization", feature(specialization, trusted_len))] -#![cfg_attr(not(feature = "allocator-api2"), feature(allocator_api))] +#![cfg_attr( + all(feature = "allocator-api", not(feature = "allocator-api2")), + feature(allocator_api) +)] extern crate alloc; +mod allocator; #[cfg(feature = "borsh")] mod borsh; mod comparisons; @@ -34,16 +38,6 @@ mod serde; mod specialization; mod taggedlen; -#[cfg(not(feature = "allocator-api2"))] -use alloc::alloc::{ - Allocator, - Global -}; -#[cfg(feature = "allocator-api2")] -use allocator_api2::alloc::{ - Allocator, - Global -}; #[cfg(feature = "bytes")] use bytes::{ BufMut, @@ -59,9 +53,11 @@ pub use errors::SmallVecError; #[cfg(feature = "std")] use std::io; use { - alloc::{ - boxed::Box, - vec::Vec + allocator::{ + Allocator, + Box, + Global, + Vec }, core::{ alloc::Layout, @@ -1786,7 +1782,7 @@ impl Drop for IntoIter { pub fn from_elem(elem: T, n: usize) -> SmallVec { if n > SmallVec::::inline_size() { // Standard Rust vectors are already specialized. - SmallVec::from_vec(alloc::vec![elem; n]) + core::iter::repeat_n(elem, n).collect() } else { #[cfg(feature = "specialization")] { diff --git a/src/rawsmallvec.rs b/src/rawsmallvec.rs index ace0e6ad..94e5ac2e 100644 --- a/src/rawsmallvec.rs +++ b/src/rawsmallvec.rs @@ -128,7 +128,7 @@ impl RawSmallVec { // `new_layout` has nonzero size. let new_ptr = allocator .allocate(new_layout) - .map_err(|_| SmallVecError::AllocationError(new_layout))? + .ok_or_else(|| SmallVecError::AllocationError(new_layout))? .cast(); unsafe { copy_nonoverlapping(ptr, new_ptr.as_ptr(), len) }; new_ptr @@ -159,7 +159,7 @@ impl RawSmallVec { new_layout ) } - .map_err(|_| SmallVecError::AllocationError(new_layout))? + .ok_or_else(|| SmallVecError::AllocationError(new_layout))? .cast() }; self.heap = (new_ptr, new_capacity); diff --git a/tests/main.rs b/tests/main.rs index 6c11a3e3..d520f22c 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -14,12 +14,20 @@ use { smallvec::SmallVec, std::{ borrow::ToOwned, - boxed::Box, hash::DefaultHasher, - rc::Rc, - vec::Vec + rc::Rc } }; +#[cfg(feature = "allocator-api2")] +use allocator_api2::{ + vec::Vec, + boxed::Box +}; +#[cfg(not(feature = "allocator-api2"))] +use std::{ + vec::Vec, + boxed::Box +}; #[test] pub fn zero() { From dd72e18ad30bcdc129931e71fc5a7784a1541302 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Mon, 21 Sep 2026 23:09:54 +0200 Subject: [PATCH 02/11] style: formatting --- tests/main.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/main.rs b/tests/main.rs index d520f22c..2707c0a6 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -1,3 +1,13 @@ +#[cfg(feature = "allocator-api2")] +use allocator_api2::{ + boxed::Box, + vec::Vec +}; +#[cfg(not(feature = "allocator-api2"))] +use std::{ + boxed::Box, + vec::Vec +}; use { core::{ borrow::{ @@ -18,16 +28,6 @@ use { rc::Rc } }; -#[cfg(feature = "allocator-api2")] -use allocator_api2::{ - vec::Vec, - boxed::Box -}; -#[cfg(not(feature = "allocator-api2"))] -use std::{ - vec::Vec, - boxed::Box -}; #[test] pub fn zero() { From e06bbffe3d91c928c644746b4aa424443d2f8930 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Mon, 21 Sep 2026 23:12:10 +0200 Subject: [PATCH 03/11] style: happy clippy --- src/allocator/base.rs | 2 +- src/rawsmallvec.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/allocator/base.rs b/src/allocator/base.rs index 758a5263..0a2d079f 100644 --- a/src/allocator/base.rs +++ b/src/allocator/base.rs @@ -28,7 +28,7 @@ impl Allocator for Global { } #[inline] - unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) -> () { + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) { unsafe { dealloc(pointer.as_ptr(), layout) }; } diff --git a/src/rawsmallvec.rs b/src/rawsmallvec.rs index 94e5ac2e..f5722b3b 100644 --- a/src/rawsmallvec.rs +++ b/src/rawsmallvec.rs @@ -128,7 +128,7 @@ impl RawSmallVec { // `new_layout` has nonzero size. let new_ptr = allocator .allocate(new_layout) - .ok_or_else(|| SmallVecError::AllocationError(new_layout))? + .ok_or(SmallVecError::AllocationError(new_layout))? .cast(); unsafe { copy_nonoverlapping(ptr, new_ptr.as_ptr(), len) }; new_ptr @@ -159,7 +159,7 @@ impl RawSmallVec { new_layout ) } - .ok_or_else(|| SmallVecError::AllocationError(new_layout))? + .ok_or(SmallVecError::AllocationError(new_layout))? .cast() }; self.heap = (new_ptr, new_capacity); From 54e2753f51b6667487d731db3b7fe8de356c010b Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Mon, 21 Sep 2026 23:13:46 +0200 Subject: [PATCH 04/11] docs: feature clarifications --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e4a1a41..3b5841f5 100644 --- a/README.md +++ b/README.md @@ -62,4 +62,5 @@ v.sort(); > [!NOTE] > - SmallVec without any features enabled does not make use of the standard library. -> - The `rayon` feature implicitly requires `std`. \ No newline at end of file +> - The `rayon` feature implicitly requires `std`. +> - The `allocator-api2` feature requires `allocator-api` \ No newline at end of file From ff80247fa74a251204db8be560559006027972bb Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Mon, 21 Sep 2026 23:15:10 +0200 Subject: [PATCH 05/11] fix: clippy --- src/allocator/external.rs | 2 +- src/allocator/mod.rs | 2 +- src/allocator/native.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/allocator/external.rs b/src/allocator/external.rs index 458df581..9b74b0fc 100644 --- a/src/allocator/external.rs +++ b/src/allocator/external.rs @@ -19,7 +19,7 @@ impl Allocator for Type { } #[inline] - unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) -> () { + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) { unsafe { External::deallocate(&self, pointer, layout) } } diff --git a/src/allocator/mod.rs b/src/allocator/mod.rs index ab50b041..a0020d22 100644 --- a/src/allocator/mod.rs +++ b/src/allocator/mod.rs @@ -30,7 +30,7 @@ pub use native::{ pub trait Allocator { fn allocate(&self, layout: Layout) -> Option>; - unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) -> (); + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout); unsafe fn grow(&self, pointer: NonNull, old: Layout, new: Layout) -> Option>; unsafe fn shrink( &self, diff --git a/src/allocator/native.rs b/src/allocator/native.rs index 529bb55e..a09f8835 100644 --- a/src/allocator/native.rs +++ b/src/allocator/native.rs @@ -19,7 +19,7 @@ impl Allocator for Type { } #[inline] - unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) -> () { + unsafe fn deallocate(&self, pointer: NonNull, layout: Layout) { unsafe { Native::deallocate(&self, pointer, layout) } } From d20d4f5f0ee77a6e7a206cb46054b8d2c7810e2d Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Mon, 21 Sep 2026 23:17:18 +0200 Subject: [PATCH 06/11] policy: add default allocator API --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index d579ebcc..27c94b11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ debug = false strip = true [features] +default = ["allocator-api2"] allocator-api = [] allocator-api2 = ["dep:allocator-api2", "allocator-api"] internals = [] From 924032c25f5f7d498c7c50ce6cc755916ac03aad Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Mon, 21 Sep 2026 23:24:17 +0200 Subject: [PATCH 07/11] fix: disable that specific fuzz operation --- fuzz/fuzz_targets/smallvec_ops.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fuzz/fuzz_targets/smallvec_ops.rs b/fuzz/fuzz_targets/smallvec_ops.rs index 991793dc..c8c731b1 100644 --- a/fuzz/fuzz_targets/smallvec_ops.rs +++ b/fuzz/fuzz_targets/smallvec_ops.rs @@ -45,7 +45,8 @@ fn do_test(data: &[u8]) -> SmallVec { v = SmallVec::with_capacity(next_usize!(bytes)); } 2 => { - v = SmallVec::from_vec(v.to_vec()); + //v = SmallVec::from_vec(v.to_vec()); + v = v } 3 => { black_box_iter(v.drain(..)); From 9169504e9b800be2dde20591f357f46b6b6dd41e Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Tue, 22 Sep 2026 14:27:54 +0200 Subject: [PATCH 08/11] refactor: simpler allocator --- src/allocator/base.rs | 4 ---- src/allocator/external.rs | 5 ----- src/allocator/mod.rs | 43 +++++++++++++++++++++++---------------- src/allocator/native.rs | 5 ----- src/lib.rs | 5 +++-- 5 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/allocator/base.rs b/src/allocator/base.rs index 0a2d079f..76ec54e8 100644 --- a/src/allocator/base.rs +++ b/src/allocator/base.rs @@ -1,7 +1,3 @@ -pub use alloc::{ - boxed::Box, - vec::Vec -}; use { super::Allocator, alloc::alloc::{ diff --git a/src/allocator/external.rs b/src/allocator/external.rs index 9b74b0fc..635a8697 100644 --- a/src/allocator/external.rs +++ b/src/allocator/external.rs @@ -1,8 +1,3 @@ -pub use allocator_api2::{ - alloc::Global, - boxed::Box, - vec::Vec -}; use { super::Allocator, allocator_api2::alloc::Allocator as External, diff --git a/src/allocator/mod.rs b/src/allocator/mod.rs index a0020d22..2c1566fd 100644 --- a/src/allocator/mod.rs +++ b/src/allocator/mod.rs @@ -1,31 +1,40 @@ #[cfg(not(feature = "allocator-api"))] mod base; -#[cfg(feature = "allocator-api2")] -mod external; #[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] mod native; +#[cfg(feature = "allocator-api2")] +mod external; -#[cfg(not(feature = "allocator-api"))] -pub use base::{ - Box, - Global, - Vec -}; use core::{ alloc::Layout, ptr::NonNull }; -#[cfg(feature = "allocator-api2")] -pub use external::{ - Box, - Global, - Vec + +#[cfg(not(feature = "allocator-api"))] +#[rustfmt::skip] +pub use { + alloc::{ + boxed::Box, + vec::Vec, + vec + }, + base::Global }; #[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] -pub use native::{ - Box, - Global, - Vec +#[rustfmt::skip] +pub use alloc::{ + alloc::Global, + boxed::Box, + vec::Vec, + vec +}; +#[cfg(feature = "allocator-api2")] +#[rustfmt::skip] +pub use allocator_api2::{ + alloc::Global, + boxed::Box, + vec::Vec, + vec }; pub trait Allocator { diff --git a/src/allocator/native.rs b/src/allocator/native.rs index a09f8835..77603616 100644 --- a/src/allocator/native.rs +++ b/src/allocator/native.rs @@ -1,8 +1,3 @@ -pub use alloc::{ - alloc::Global, - boxed::Box, - vec::Vec -}; use { super::Allocator, alloc::alloc::Allocator as Native, diff --git a/src/lib.rs b/src/lib.rs index 7051c0c0..56f8731c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,7 +57,8 @@ use { Allocator, Box, Global, - Vec + Vec, + vec }, core::{ alloc::Layout, @@ -1782,7 +1783,7 @@ impl Drop for IntoIter { pub fn from_elem(elem: T, n: usize) -> SmallVec { if n > SmallVec::::inline_size() { // Standard Rust vectors are already specialized. - core::iter::repeat_n(elem, n).collect() + SmallVec::from_vec(vec![elem; n]) } else { #[cfg(feature = "specialization")] { From 7f9e734f02a8d4adc02a7328bcd5d8c984b6b54e Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Tue, 22 Sep 2026 14:34:42 +0200 Subject: [PATCH 09/11] style: formatting --- src/allocator/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/allocator/mod.rs b/src/allocator/mod.rs index 2c1566fd..2e212219 100644 --- a/src/allocator/mod.rs +++ b/src/allocator/mod.rs @@ -1,9 +1,9 @@ #[cfg(not(feature = "allocator-api"))] mod base; -#[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] -mod native; #[cfg(feature = "allocator-api2")] mod external; +#[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] +mod native; use core::{ alloc::Layout, @@ -20,17 +20,17 @@ pub use { }, base::Global }; -#[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] +#[cfg(feature = "allocator-api2")] #[rustfmt::skip] -pub use alloc::{ +pub use allocator_api2::{ alloc::Global, boxed::Box, vec::Vec, vec }; -#[cfg(feature = "allocator-api2")] +#[cfg(all(feature = "allocator-api", not(feature = "allocator-api2")))] #[rustfmt::skip] -pub use allocator_api2::{ +pub use alloc::{ alloc::Global, boxed::Box, vec::Vec, From 961d2a2dad5f8741868bf5cb728149f919604edb Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Tue, 22 Sep 2026 18:50:29 +0200 Subject: [PATCH 10/11] policy: no default features --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 27c94b11..d579ebcc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,6 @@ debug = false strip = true [features] -default = ["allocator-api2"] allocator-api = [] allocator-api2 = ["dep:allocator-api2", "allocator-api"] internals = [] From 83d9988517a375c6e2b66535cb316a8639ee2166 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Tue, 22 Sep 2026 19:12:40 +0200 Subject: [PATCH 11/11] fix: re enable fuzzing --- fuzz/fuzz_targets/smallvec_ops.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fuzz/fuzz_targets/smallvec_ops.rs b/fuzz/fuzz_targets/smallvec_ops.rs index c8c731b1..991793dc 100644 --- a/fuzz/fuzz_targets/smallvec_ops.rs +++ b/fuzz/fuzz_targets/smallvec_ops.rs @@ -45,8 +45,7 @@ fn do_test(data: &[u8]) -> SmallVec { v = SmallVec::with_capacity(next_usize!(bytes)); } 2 => { - //v = SmallVec::from_vec(v.to_vec()); - v = v + v = SmallVec::from_vec(v.to_vec()); } 3 => { black_box_iter(v.drain(..));