|
69 | 69 | //! [`vec!`]: ../macro.vec.html |
70 | 70 |
|
71 | 71 | use crate::{ |
72 | | - alloc::{handle_alloc_error, AllocRef, BuildAllocRef, DeallocRef, Global, ReallocRef}, |
| 72 | + alloc::{ |
| 73 | + handle_alloc_error, |
| 74 | + AllocRef, |
| 75 | + BuildAllocRef, |
| 76 | + DeallocRef, |
| 77 | + Global, |
| 78 | + PanicAdapter, |
| 79 | + ReallocRef, |
| 80 | + }, |
73 | 81 | boxed::Box, |
74 | 82 | clone::CloneIn, |
75 | 83 | collections::CollectionAllocErr, |
@@ -328,7 +336,7 @@ use core::{ |
328 | 336 | /// [`insert`]: Self::insert() |
329 | 337 | /// [`reserve`]: Self::reserve |
330 | 338 | /// [owned slice]: crate::boxed::Box |
331 | | -pub struct Vec<T, A: DeallocRef = Global> { |
| 339 | +pub struct Vec<T, A: DeallocRef = PanicAdapter<Global>> { |
332 | 340 | buf: RawVec<T, A>, |
333 | 341 | len: usize, |
334 | 342 | } |
@@ -401,7 +409,7 @@ impl<T> Vec<T> { |
401 | 409 | #[inline] |
402 | 410 | #[must_use] |
403 | 411 | pub fn with_capacity(capacity: usize) -> Self { |
404 | | - Self::with_capacity_in(capacity, Global) |
| 412 | + Self::with_capacity_in(capacity, PanicAdapter(Global)) |
405 | 413 | } |
406 | 414 |
|
407 | 415 | /// Creates a `Vec<T>` directly from the raw components of another vector. |
@@ -664,7 +672,7 @@ impl<T, A: DeallocRef> Vec<T, A> { |
664 | 672 | /// # Examples |
665 | 673 | /// |
666 | 674 | /// ``` |
667 | | - /// use alloc_wg::{alloc::Global, collections::CollectionAllocErr, vec::Vec}; |
| 675 | + /// use alloc_wg::{alloc::PanicAdapter<Global>, collections::CollectionAllocErr, vec::Vec}; |
668 | 676 | /// |
669 | 677 | /// fn process_data(data: &[u32]) -> Result<Vec<u32>, CollectionAllocErr<Global>> { |
670 | 678 | /// let mut output = Vec::new(); |
@@ -2024,7 +2032,7 @@ impl<T: PartialEq, A: DeallocRef> Vec<T, A> { |
2024 | 2032 |
|
2025 | 2033 | #[doc(hidden)] |
2026 | 2034 | pub fn from_elem<T: Clone>(elem: T, n: usize) -> Vec<T> { |
2027 | | - from_elem_in(elem, n, Global) |
| 2035 | + from_elem_in(elem, n, PanicAdapter(Global)) |
2028 | 2036 | } |
2029 | 2037 |
|
2030 | 2038 | #[doc(hidden)] |
@@ -2267,7 +2275,10 @@ impl<T> FromIterator<T> for Vec<T> { |
2267 | 2275 | #[inline] |
2268 | 2276 | #[must_use] |
2269 | 2277 | fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self { |
2270 | | - <Self as SpecExtend<T, I::IntoIter, Global>>::from_iter_in(iter.into_iter(), Global) |
| 2278 | + <Self as SpecExtend<T, I::IntoIter, PanicAdapter<Global>>>::from_iter_in( |
| 2279 | + iter.into_iter(), |
| 2280 | + PanicAdapter(Global), |
| 2281 | + ) |
2271 | 2282 | } |
2272 | 2283 | } |
2273 | 2284 |
|
@@ -2896,7 +2907,7 @@ impl From<&str> for Vec<u8> { |
2896 | 2907 | /// |
2897 | 2908 | /// [`Vec`]: struct.Vec.html |
2898 | 2909 | /// [`IntoIterator`]: ../../std/iter/trait.IntoIterator.html |
2899 | | -pub struct IntoIter<T, A: DeallocRef = Global> { |
| 2910 | +pub struct IntoIter<T, A: DeallocRef = PanicAdapter<Global>> { |
2900 | 2911 | buf: RawVec<T, A>, |
2901 | 2912 | ptr: *const T, |
2902 | 2913 | end: *const T, |
@@ -3042,7 +3053,7 @@ impl<T, A: DeallocRef> Drop for IntoIter<T, A> { |
3042 | 3053 | /// |
3043 | 3054 | /// [`drain`]: struct.Vec.html#method.drain |
3044 | 3055 | /// [`Vec`]: struct.Vec.html |
3045 | | -pub struct Drain<'a, T, A: DeallocRef = Global> { |
| 3056 | +pub struct Drain<'a, T, A: DeallocRef = PanicAdapter<Global>> { |
3046 | 3057 | /// Index of tail to preserve |
3047 | 3058 | tail_start: usize, |
3048 | 3059 | /// Length of tail |
@@ -3135,7 +3146,7 @@ impl<T, A: DeallocRef> FusedIterator for Drain<'_, T, A> {} |
3135 | 3146 | /// [`splice()`]: struct.Vec.html#method.splice |
3136 | 3147 | /// [`Vec`]: struct.Vec.html |
3137 | 3148 | #[derive(Debug)] |
3138 | | -pub struct Splice<'a, I: Iterator + 'a, A = Global> |
| 3149 | +pub struct Splice<'a, I: Iterator + 'a, A = PanicAdapter<Global>> |
3139 | 3150 | where |
3140 | 3151 | A: ReallocRef, |
3141 | 3152 | { |
@@ -3257,7 +3268,7 @@ where |
3257 | 3268 |
|
3258 | 3269 | /// An iterator produced by calling `drain_filter` on Vec. |
3259 | 3270 | // #[derive(Debug)] |
3260 | | -pub struct DrainFilter<'a, T, F, A: DeallocRef = Global> |
| 3271 | +pub struct DrainFilter<'a, T, F, A: DeallocRef = PanicAdapter<Global>> |
3261 | 3272 | where |
3262 | 3273 | F: FnMut(&mut T) -> bool, |
3263 | 3274 | { |
@@ -3320,7 +3331,7 @@ where |
3320 | 3331 | F: FnMut(&mut T) -> bool, |
3321 | 3332 | { |
3322 | 3333 | fn drop(&mut self) { |
3323 | | - struct BackshiftOnDrop<'a, 'b, T, F, A: DeallocRef = Global> |
| 3334 | + struct BackshiftOnDrop<'a, 'b, T, F, A: DeallocRef = PanicAdapter<Global>> |
3324 | 3335 | where |
3325 | 3336 | F: FnMut(&mut T) -> bool, |
3326 | 3337 | { |
|
0 commit comments