@@ -165,6 +165,7 @@ use core::ops::{
165165} ;
166166use core:: pin:: Pin ;
167167use core:: ptr:: { self , addr_of_mut, NonNull , Unique } ;
168+ use core:: slice;
168169use core:: task:: { Context , Poll } ;
169170
170171#[ cfg( not( no_global_oom_handling) ) ]
@@ -177,6 +178,7 @@ use crate::raw_vec::RawVec;
177178use crate :: str:: from_boxed_utf8_unchecked;
178179#[ cfg( not( no_global_oom_handling) ) ]
179180use crate :: string:: String ;
181+ use crate :: vec;
180182#[ cfg( not( no_global_oom_handling) ) ]
181183use crate :: vec:: Vec ;
182184
@@ -2073,6 +2075,42 @@ impl<I> FromIterator<I> for Box<[I]> {
20732075 }
20742076}
20752077
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+
20762114#[ cfg( not( no_global_oom_handling) ) ]
20772115#[ stable( feature = "box_slice_clone" , since = "1.3.0" ) ]
20782116impl < T : Clone , A : Allocator + Clone > Clone for Box < [ T ] , A > {
0 commit comments