@@ -14,8 +14,9 @@ pub struct FlatMap<I, U: IntoIterator, F> {
1414}
1515
1616impl < I : Iterator , U : IntoIterator , F : FnMut ( I :: Item ) -> U > FlatMap < I , U , F > {
17- pub ( in crate :: iter) fn new ( iter : I , f : F ) -> FlatMap < I , U , F > {
18- FlatMap { inner : FlattenCompat :: new ( iter. map ( f) ) }
17+ #[ rustc_const_unstable( feature = "iter_internals" , issue = "none" ) ]
18+ pub ( in crate :: iter) const fn new ( iter : I , f : F ) -> FlatMap < I , U , F > {
19+ FlatMap { inner : FlattenCompat :: new ( Map :: new ( iter, f) ) }
1920 }
2021}
2122
@@ -152,7 +153,8 @@ pub struct Flatten<I: Iterator<Item: IntoIterator>> {
152153}
153154
154155impl < I : Iterator < Item : IntoIterator > > Flatten < I > {
155- pub ( in super :: super ) fn new ( iter : I ) -> Flatten < I > {
156+ #[ rustc_const_unstable( feature = "iter_internals" , issue = "none" ) ]
157+ pub ( in super :: super ) const fn new ( iter : I ) -> Flatten < I > {
156158 Flatten { inner : FlattenCompat :: new ( iter) }
157159 }
158160}
@@ -270,13 +272,10 @@ struct FlattenCompat<I, U> {
270272 frontiter : Option < U > ,
271273 backiter : Option < U > ,
272274}
273- impl < I , U > FlattenCompat < I , U >
274- where
275- I : Iterator ,
276- {
275+ impl < I , U > FlattenCompat < I , U > {
277276 /// Adapts an iterator by flattening it, for use in `flatten()` and `flat_map()`.
278- fn new ( iter : I ) -> FlattenCompat < I , U > {
279- FlattenCompat { iter : iter . fuse ( ) , frontiter : None , backiter : None }
277+ const fn new ( iter : I ) -> FlattenCompat < I , U > {
278+ FlattenCompat { iter : super :: Fuse :: new ( iter ) , frontiter : None , backiter : None }
280279 }
281280}
282281
0 commit comments