28
28
//!
29
29
//! ### `union`
30
30
//!
31
- //! **This feature is unstable and requires a nightly build of the Rust toolchain .**
31
+ //! **This feature requires Rust 1.50 .**
32
32
//!
33
33
//! When the `union` feature is enabled `smallvec` will track its state (inline or spilled)
34
34
//! without the use of an enum tag, reducing the size of the `smallvec` by one machine word.
37
37
//! machine words.
38
38
//!
39
39
//! To use this feature add `features = ["union"]` in the `smallvec` section of Cargo.toml.
40
- //! Note that this feature requires a nightly compiler (for now) .
40
+ //! Note that this feature requires Rust 1.50 .
41
41
//!
42
42
//! Tracking issue: [rust-lang/rust#55149](https://github.com/rust-lang/rust/issues/55149)
43
43
//!
71
71
//! Tracking issue: [rust-lang/rust#34761](https://github.com/rust-lang/rust/issues/34761)
72
72
73
73
#![ no_std]
74
- #![ cfg_attr( feature = "union" , feature( untagged_unions) ) ]
75
74
#![ cfg_attr( feature = "specialization" , allow( incomplete_features) ) ]
76
75
#![ cfg_attr( feature = "specialization" , feature( specialization) ) ]
77
76
#![ cfg_attr( feature = "may_dangle" , feature( dropck_eyepatch) ) ]
@@ -352,7 +351,7 @@ impl<'a, T: 'a + Array> Drop for Drain<'a, T> {
352
351
353
352
#[ cfg( feature = "union" ) ]
354
353
union SmallVecData < A : Array > {
355
- inline : MaybeUninit < A > ,
354
+ inline : core :: mem :: ManuallyDrop < MaybeUninit < A > > ,
356
355
heap : ( * mut A :: Item , usize ) ,
357
356
}
358
357
@@ -368,11 +367,13 @@ impl<A: Array> SmallVecData<A> {
368
367
}
369
368
#[ inline]
370
369
fn from_inline ( inline : MaybeUninit < A > ) -> SmallVecData < A > {
371
- SmallVecData { inline }
370
+ SmallVecData {
371
+ inline : core:: mem:: ManuallyDrop :: new ( inline) ,
372
+ }
372
373
}
373
374
#[ inline]
374
375
unsafe fn into_inline ( self ) -> MaybeUninit < A > {
375
- self . inline
376
+ core :: mem :: ManuallyDrop :: into_inner ( self . inline )
376
377
}
377
378
#[ inline]
378
379
unsafe fn heap ( & self ) -> ( * mut A :: Item , usize ) {
@@ -793,7 +794,8 @@ impl<A: Array> SmallVec<A> {
793
794
/// assert_eq!(*v1, []);
794
795
/// ```
795
796
pub fn append < B > ( & mut self , other : & mut SmallVec < B > )
796
- where B : Array < Item = A :: Item >
797
+ where
798
+ B : Array < Item = A :: Item > ,
797
799
{
798
800
self . extend ( other. drain ( ..) )
799
801
}
@@ -1957,10 +1959,9 @@ macro_rules! impl_array(
1957
1959
1958
1960
#[ cfg( not( feature = "const_generics" ) ) ]
1959
1961
impl_array ! (
1960
- 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 ,
1961
- 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 36 , 0x40 , 0x60 , 0x80 ,
1962
- 0x100 , 0x200 , 0x400 , 0x600 , 0x800 , 0x1000 , 0x2000 , 0x4000 , 0x6000 , 0x8000 , 0x10000 , 0x20000 ,
1963
- 0x40000 , 0x60000 , 0x80000 , 0x10_0000
1962
+ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 ,
1963
+ 26 , 27 , 28 , 29 , 30 , 31 , 32 , 36 , 0x40 , 0x60 , 0x80 , 0x100 , 0x200 , 0x400 , 0x600 , 0x800 , 0x1000 ,
1964
+ 0x2000 , 0x4000 , 0x6000 , 0x8000 , 0x10000 , 0x20000 , 0x40000 , 0x60000 , 0x80000 , 0x10_0000
1964
1965
) ;
1965
1966
1966
1967
/// Convenience trait for constructing a `SmallVec`
0 commit comments