@@ -163,6 +163,7 @@ use core::ops::{
163163} ;
164164use core:: pin:: Pin ;
165165use core:: ptr:: { self , NonNull , Unique } ;
166+ use core:: slice;
166167use core:: task:: { Context , Poll } ;
167168
168169#[ cfg( not( no_global_oom_handling) ) ]
@@ -175,6 +176,7 @@ use crate::raw_vec::RawVec;
175176use crate :: str:: from_boxed_utf8_unchecked;
176177#[ cfg( not( no_global_oom_handling) ) ]
177178use crate :: string:: String ;
179+ use crate :: vec;
178180#[ cfg( not( no_global_oom_handling) ) ]
179181use crate :: vec:: Vec ;
180182
@@ -2036,6 +2038,42 @@ impl<I> FromIterator<I> for Box<[I]> {
20362038 }
20372039}
20382040
2041+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2042+ impl < I , A : Allocator > !Iterator for Box < [ I ] , A > { }
2043+
2044+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2045+ impl < I , A : Allocator > IntoIterator for Box < [ I ] , A > {
2046+ type IntoIter = vec:: IntoIter < I , A > ;
2047+ type Item = I ;
2048+ fn into_iter ( self ) -> vec:: IntoIter < I , A > {
2049+ self . into_vec ( ) . into_iter ( )
2050+ }
2051+ }
2052+
2053+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2054+ impl < ' a , I , A : Allocator > !Iterator for & ' a Box < [ I ] , A > { }
2055+
2056+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2057+ impl < ' a , I , A : Allocator > IntoIterator for & ' a Box < [ I ] , A > {
2058+ type IntoIter = slice:: Iter < ' a , I > ;
2059+ type Item = & ' a I ;
2060+ fn into_iter ( self ) -> slice:: Iter < ' a , I > {
2061+ self . iter ( )
2062+ }
2063+ }
2064+
2065+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2066+ impl < ' a , I , A : Allocator > !Iterator for & ' a mut Box < [ I ] , A > { }
2067+
2068+ #[ stable( feature = "boxed_slice_into_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2069+ impl < ' a , I , A : Allocator > IntoIterator for & ' a mut Box < [ I ] , A > {
2070+ type IntoIter = slice:: IterMut < ' a , I > ;
2071+ type Item = & ' a mut I ;
2072+ fn into_iter ( self ) -> slice:: IterMut < ' a , I > {
2073+ self . iter_mut ( )
2074+ }
2075+ }
2076+
20392077#[ cfg( not( no_global_oom_handling) ) ]
20402078#[ stable( feature = "box_slice_clone" , since = "1.3.0" ) ]
20412079impl < T : Clone , A : Allocator + Clone > Clone for Box < [ T ] , A > {
0 commit comments