@@ -12,7 +12,7 @@ use std::{
12
12
slice:: SliceIndex ,
13
13
} ;
14
14
15
- use allocator_api2:: vec;
15
+ use allocator_api2:: vec:: Vec as InnerVec ;
16
16
use bumpalo:: Bump ;
17
17
#[ cfg( any( feature = "serialize" , test) ) ]
18
18
use serde:: { ser:: SerializeSeq , Serialize , Serializer } ;
@@ -29,7 +29,7 @@ use crate::{Allocator, Box, String};
29
29
/// Note: This is not a soundness issue, as Rust does not support relying on `drop`
30
30
/// being called to guarantee soundness.
31
31
#[ derive( PartialEq , Eq ) ]
32
- pub struct Vec < ' alloc , T > ( ManuallyDrop < vec :: Vec < T , & ' alloc Bump > > ) ;
32
+ pub struct Vec < ' alloc , T > ( ManuallyDrop < InnerVec < T , & ' alloc Bump > > ) ;
33
33
34
34
/// SAFETY: Not actually safe, but for enabling `Send` for downstream crates.
35
35
unsafe impl < T > Send for Vec < ' _ , T > { }
@@ -53,7 +53,7 @@ impl<'alloc, T> Vec<'alloc, T> {
53
53
/// ```
54
54
#[ inline]
55
55
pub fn new_in ( allocator : & ' alloc Allocator ) -> Self {
56
- Self ( ManuallyDrop :: new ( vec :: Vec :: new_in ( allocator) ) )
56
+ Self ( ManuallyDrop :: new ( InnerVec :: new_in ( allocator) ) )
57
57
}
58
58
59
59
/// Constructs a new, empty `Vec<T>` with at least the specified capacity
@@ -105,7 +105,7 @@ impl<'alloc, T> Vec<'alloc, T> {
105
105
/// ```
106
106
#[ inline]
107
107
pub fn with_capacity_in ( capacity : usize , allocator : & ' alloc Allocator ) -> Self {
108
- Self ( ManuallyDrop :: new ( vec :: Vec :: with_capacity_in ( capacity, allocator) ) )
108
+ Self ( ManuallyDrop :: new ( InnerVec :: with_capacity_in ( capacity, allocator) ) )
109
109
}
110
110
111
111
/// Create a new [`Vec`] whose elements are taken from an iterator and
@@ -117,7 +117,7 @@ impl<'alloc, T> Vec<'alloc, T> {
117
117
let iter = iter. into_iter ( ) ;
118
118
let hint = iter. size_hint ( ) ;
119
119
let capacity = hint. 1 . unwrap_or ( hint. 0 ) ;
120
- let mut vec = ManuallyDrop :: new ( vec :: Vec :: with_capacity_in ( capacity, & * * allocator) ) ;
120
+ let mut vec = ManuallyDrop :: new ( InnerVec :: with_capacity_in ( capacity, & * * allocator) ) ;
121
121
vec. extend ( iter) ;
122
122
Self ( vec)
123
123
}
@@ -146,7 +146,7 @@ impl<'alloc, T> Vec<'alloc, T> {
146
146
// `ptr` was allocated with correct size for `[T; N]`.
147
147
// `len` and `capacity` are both `N`.
148
148
// Allocated size cannot be larger than `isize::MAX`, or `Box::new_in` would have failed.
149
- let vec = unsafe { vec :: Vec :: from_raw_parts_in ( ptr, N , N , & * * allocator) } ;
149
+ let vec = unsafe { InnerVec :: from_raw_parts_in ( ptr, N , N , & * * allocator) } ;
150
150
Self ( ManuallyDrop :: new ( vec) )
151
151
}
152
152
@@ -218,21 +218,21 @@ impl<'alloc> Vec<'alloc, u8> {
218
218
}
219
219
220
220
impl < ' alloc , T > ops:: Deref for Vec < ' alloc , T > {
221
- type Target = vec :: Vec < T , & ' alloc Bump > ;
221
+ type Target = InnerVec < T , & ' alloc Bump > ;
222
222
223
223
fn deref ( & self ) -> & Self :: Target {
224
224
& self . 0
225
225
}
226
226
}
227
227
228
228
impl < ' alloc , T > ops:: DerefMut for Vec < ' alloc , T > {
229
- fn deref_mut ( & mut self ) -> & mut vec :: Vec < T , & ' alloc Bump > {
229
+ fn deref_mut ( & mut self ) -> & mut InnerVec < T , & ' alloc Bump > {
230
230
& mut self . 0
231
231
}
232
232
}
233
233
234
234
impl < ' alloc , T > IntoIterator for Vec < ' alloc , T > {
235
- type IntoIter = <vec :: Vec < T , & ' alloc Bump > as IntoIterator >:: IntoIter ;
235
+ type IntoIter = <InnerVec < T , & ' alloc Bump > as IntoIterator >:: IntoIter ;
236
236
type Item = T ;
237
237
238
238
fn into_iter ( self ) -> Self :: IntoIter {
0 commit comments