@@ -165,6 +165,7 @@ use core::ops::{
165
165
} ;
166
166
use core:: pin:: Pin ;
167
167
use core:: ptr:: { self , addr_of_mut, NonNull , Unique } ;
168
+ use core:: slice;
168
169
use core:: task:: { Context , Poll } ;
169
170
170
171
#[ cfg( not( no_global_oom_handling) ) ]
@@ -177,6 +178,7 @@ use crate::raw_vec::RawVec;
177
178
use crate :: str:: from_boxed_utf8_unchecked;
178
179
#[ cfg( not( no_global_oom_handling) ) ]
179
180
use crate :: string:: String ;
181
+ use crate :: vec;
180
182
#[ cfg( not( no_global_oom_handling) ) ]
181
183
use crate :: vec:: Vec ;
182
184
@@ -2073,6 +2075,42 @@ impl<I> FromIterator<I> for Box<[I]> {
2073
2075
}
2074
2076
}
2075
2077
2078
+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2079
+ impl < I , A : Allocator > !Iterator for Box < [ I ] , A > { }
2080
+
2081
+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2082
+ impl < I , A : Allocator > IntoIterator for Box < [ I ] , A > {
2083
+ type IntoIter = vec:: IntoIter < I , A > ;
2084
+ type Item = I ;
2085
+ fn into_iter ( self ) -> vec:: IntoIter < I , A > {
2086
+ self . into_vec ( ) . into_iter ( )
2087
+ }
2088
+ }
2089
+
2090
+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2091
+ impl < ' a , I , A : Allocator > !Iterator for & ' a Box < [ I ] , A > { }
2092
+
2093
+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2094
+ impl < ' a , I , A : Allocator > IntoIterator for & ' a Box < [ I ] , A > {
2095
+ type IntoIter = slice:: Iter < ' a , I > ;
2096
+ type Item = & ' a I ;
2097
+ fn into_iter ( self ) -> slice:: Iter < ' a , I > {
2098
+ self . iter ( )
2099
+ }
2100
+ }
2101
+
2102
+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2103
+ impl < ' a , I , A : Allocator > !Iterator for & ' a mut Box < [ I ] , A > { }
2104
+
2105
+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2106
+ impl < ' a , I , A : Allocator > IntoIterator for & ' a mut Box < [ I ] , A > {
2107
+ type IntoIter = slice:: IterMut < ' a , I > ;
2108
+ type Item = & ' a mut I ;
2109
+ fn into_iter ( self ) -> slice:: IterMut < ' a , I > {
2110
+ self . iter_mut ( )
2111
+ }
2112
+ }
2113
+
2076
2114
#[ cfg( not( no_global_oom_handling) ) ]
2077
2115
#[ stable( feature = "box_slice_clone" , since = "1.3.0" ) ]
2078
2116
impl < T : Clone , A : Allocator + Clone > Clone for Box < [ T ] , A > {
0 commit comments