@@ -209,24 +209,24 @@ use raw::Storage;
209209pub use core;
210210
211211/// A heap backed vector with a growable capacity
212- #[ cfg( all( feature = "alloc" , feature = "nightly" ) ) ]
212+ #[ cfg( any ( doc , all( feature = "alloc" , feature = "nightly" ) ) ) ]
213213#[ cfg_attr( doc, doc( cfg( all( feature = "alloc" , feature = "nightly" ) ) ) ) ]
214214pub type HeapVec < T , A = std:: alloc:: Global > = GenericVec < T , raw:: Heap < T , A > > ;
215215
216216/// A heap backed vector with a growable capacity
217- #[ cfg( all( feature = "alloc" , not( feature = "nightly" ) ) ) ]
217+ #[ cfg( all( not ( doc ) , feature = "alloc" , not( feature = "nightly" ) ) ) ]
218218#[ cfg_attr( doc, doc( cfg( feature = "alloc" ) ) ) ]
219219pub type HeapVec < T > = GenericVec < T , raw:: Heap < T > > ;
220220
221221/// An array backed vector backed by potentially uninitialized memory
222- #[ cfg( feature = "nightly" ) ]
222+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
223223#[ cfg_attr( doc, doc( cfg( feature = "nightly" ) ) ) ]
224224pub type ArrayVec < T , const N : usize > = TypeVec < T , [ T ; N ] > ;
225225/// An slice backed vector backed by potentially uninitialized memory
226226pub type SliceVec < ' a , T > = GenericVec < T , & ' a mut raw:: UninitSlice < T > > ;
227227
228228/// An array backed vector backed by initialized memory
229- #[ cfg( feature = "nightly" ) ]
229+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
230230#[ cfg_attr( doc, doc( cfg( feature = "nightly" ) ) ) ]
231231pub type InitArrayVec < T , const N : usize > = GenericVec < T , [ T ; N ] > ;
232232/// An slice backed vector backed by initialized memory
@@ -492,7 +492,7 @@ impl<T, B, A> TypeVec<T, B, A> {
492492 }
493493}
494494
495- #[ cfg( feature = "nightly" ) ]
495+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
496496#[ cfg_attr( doc, doc( cfg( feature = "nightly" ) ) ) ]
497497impl < T , const N : usize > ArrayVec < T , N > {
498498 /// Create a new full `ArrayVec`
@@ -542,28 +542,28 @@ impl<T> HeapVec<T> {
542542 }
543543}
544544
545- #[ cfg( all( feature = "nightly" , feature = "alloc" ) ) ]
545+ #[ cfg( any ( doc , all( feature = "nightly" , feature = "alloc" ) ) ) ]
546546#[ cfg_attr( doc, doc( cfg( all( feature = "nightly" , feature = "alloc" ) ) ) ) ]
547547impl < T , A : std:: alloc:: AllocRef > HeapVec < T , A > {
548548 /// Create a new empty `HeapVec` with the given allocator
549549 pub fn with_alloc ( alloc : A ) -> Self { Self :: with_storage ( raw:: Heap :: with_alloc ( alloc) ) }
550550}
551551
552- #[ cfg( not( feature = "nightly" ) ) ]
552+ #[ cfg( any ( doc , not( feature = "nightly" ) ) ) ]
553553impl < ' a , T > SliceVec < ' a , T > {
554554 /// Create a new empty `SliceVec`
555555 pub fn new ( slice : & ' a mut [ MaybeUninit < T > ] ) -> Self { Self :: with_storage ( raw:: UninitSlice :: from_mut ( slice) ) }
556556}
557557
558- #[ cfg( feature = "nightly" ) ]
558+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
559559impl < ' a , T > SliceVec < ' a , T > {
560560 /// Create a new empty `SliceVec`
561561 ///
562562 /// Note: this is only const with the `nightly` feature enabled
563563 pub const fn new ( slice : & ' a mut [ MaybeUninit < T > ] ) -> Self { Self :: with_storage ( raw:: UninitSlice :: from_mut ( slice) ) }
564564}
565565
566- #[ cfg( not( feature = "nightly" ) ) ]
566+ #[ cfg( any ( doc , not( feature = "nightly" ) ) ) ]
567567impl < ' a , T : Copy > InitSliceVec < ' a , T > {
568568 /// Create a new full `InitSliceVec`
569569 pub fn new ( storage : & ' a mut [ T ] ) -> Self {
@@ -986,7 +986,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
986986 /// # Panic
987987 ///
988988 /// May panic or reallocate if the collection has less than N elements remaining
989- #[ cfg( feature = "nightly" ) ]
989+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
990990 pub fn push_array < const N : usize > ( & mut self , value : [ T ; N ] ) -> & mut [ T ; N ] {
991991 self . reserve ( N ) ;
992992
@@ -1032,7 +1032,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
10321032 ///
10331033 /// * May panic or reallocate if the collection has less than N elements remaining
10341034 /// * Panics if index > len.
1035- #[ cfg( feature = "nightly" ) ]
1035+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
10361036 pub fn insert_array < const N : usize > ( & mut self , index : usize , value : [ T ; N ] ) -> & mut [ T ; N ] {
10371037 #[ cold]
10381038 #[ inline( never) ]
@@ -1083,7 +1083,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
10831083 /// # Panics
10841084 ///
10851085 /// Panics if the collection contains less than `N` elements in it
1086- #[ cfg( feature = "nightly" ) ]
1086+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
10871087 pub fn pop_array < const N : usize > ( & mut self ) -> [ T ; N ] {
10881088 #[ cold]
10891089 #[ inline( never) ]
@@ -1130,7 +1130,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
11301130 /// # Panics
11311131 ///
11321132 /// Panics if `index` is out of bounds or if `index + N > len()`
1133- #[ cfg( feature = "nightly" ) ]
1133+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
11341134 pub fn remove_array < const N : usize > ( & mut self , index : usize ) -> [ T ; N ] {
11351135 #[ cold]
11361136 #[ inline( never) ]
@@ -1199,7 +1199,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
11991199 /// to hold `N` elements.
12001200 ///
12011201 /// Guaranteed to not panic/abort/allocate
1202- #[ cfg( feature = "nightly" ) ]
1202+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
12031203 pub fn try_push_array < const N : usize > ( & mut self , value : [ T ; N ] ) -> Result < & mut [ T ; N ] , [ T ; N ] > {
12041204 if self . remaining_capacity ( ) < N {
12051205 Err ( value)
@@ -1234,7 +1234,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
12341234 /// to hold `N` elements or index is out of bounds
12351235 ///
12361236 /// Guaranteed to not panic/abort/allocate
1237- #[ cfg( feature = "nightly" ) ]
1237+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
12381238 pub fn try_insert_array < const N : usize > ( & mut self , index : usize , value : [ T ; N ] ) -> Result < & mut [ T ; N ] , [ T ; N ] > {
12391239 if self . capacity ( ) . wrapping_sub ( self . len ( ) ) < N || index > self . len ( ) {
12401240 Err ( value)
@@ -1266,7 +1266,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
12661266 /// Returns `None` if the collection is has less than N elements
12671267 ///
12681268 /// Guaranteed to not panic/abort/allocate
1269- #[ cfg( feature = "nightly" ) ]
1269+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
12701270 pub fn try_pop_array < const N : usize > ( & mut self ) -> Option < [ T ; N ] > {
12711271 if self . is_empty ( ) {
12721272 None
@@ -1300,7 +1300,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
13001300 /// or `index` is out of bounds.
13011301 ///
13021302 /// Guaranteed to not panic/abort/allocate
1303- #[ cfg( feature = "nightly" ) ]
1303+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
13041304 pub fn try_remove_array < const N : usize > ( & mut self , index : usize ) -> Option < [ T ; N ] > {
13051305 if self . len ( ) < index || self . len ( ) . wrapping_sub ( index) < N {
13061306 None
@@ -1366,7 +1366,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
13661366 /// # Safety
13671367 ///
13681368 /// the collection's remaining capacity must be at least N
1369- #[ cfg( feature = "nightly" ) ]
1369+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
13701370 pub unsafe fn push_array_unchecked < const N : usize > ( & mut self , value : [ T ; N ] ) -> & mut [ T ; N ] {
13711371 match S :: CONST_CAPACITY {
13721372 Some ( n) if n < N => {
@@ -1422,7 +1422,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
14221422 ///
14231423 /// * the collection's remaining capacity must be at least N
14241424 /// * hte index must be in bounds
1425- #[ cfg( feature = "nightly" ) ]
1425+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
14261426 pub unsafe fn insert_array_unchecked < const N : usize > ( & mut self , index : usize , value : [ T ; N ] ) -> & mut [ T ; N ] {
14271427 match S :: CONST_CAPACITY {
14281428 Some ( n) if n < N => {
@@ -1481,7 +1481,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
14811481 /// # Safety
14821482 ///
14831483 /// The collection must contain at least `N` elements in it
1484- #[ cfg( feature = "nightly" ) ]
1484+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
14851485 pub unsafe fn pop_array_unchecked < const N : usize > ( & mut self ) -> [ T ; N ] {
14861486 match S :: CONST_CAPACITY {
14871487 Some ( n) if n < N => panic ! ( "Tried to remove {} elements from a {} capacity vector!" , N , n) ,
@@ -1546,7 +1546,7 @@ impl<T, S: ?Sized + Storage<T>> GenericVec<T, S> {
15461546 ///
15471547 /// the collection must contain at least N elements, and
15481548 /// index must be in bounds
1549- #[ cfg( feature = "nightly" ) ]
1549+ #[ cfg( any ( doc , feature = "nightly" ) ) ]
15501550 pub unsafe fn remove_array_unchecked < const N : usize > ( & mut self , index : usize ) -> [ T ; N ] {
15511551 match S :: CONST_CAPACITY {
15521552 Some ( n) if n < N => panic ! ( "Tried to remove {} elements from a {} capacity vector!" , N , n) ,
0 commit comments