mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-18 02:34:37 +00:00
Auto merge of #89638 - rust-lang:revert-88548-intersperse, r=Mark-Simulacrum
Revert "Stabilize `Iterator::intersperse()`" Reverts rust-lang/rust#88548 First step in resolving https://github.com/rust-lang/rust/issues/88967
This commit is contained in:
commit
2ee06e7372
@ -4,7 +4,7 @@ use super::Peekable;
|
|||||||
///
|
///
|
||||||
/// This `struct` is created by [`Iterator::intersperse`]. See its documentation
|
/// This `struct` is created by [`Iterator::intersperse`]. See its documentation
|
||||||
/// for more information.
|
/// for more information.
|
||||||
#[stable(feature = "iter_intersperse", since = "1.56.0")]
|
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Intersperse<I: Iterator>
|
pub struct Intersperse<I: Iterator>
|
||||||
where
|
where
|
||||||
@ -24,7 +24,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "iter_intersperse", since = "1.56.0")]
|
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
|
||||||
impl<I> Iterator for Intersperse<I>
|
impl<I> Iterator for Intersperse<I>
|
||||||
where
|
where
|
||||||
I: Iterator,
|
I: Iterator,
|
||||||
@ -61,7 +61,7 @@ where
|
|||||||
///
|
///
|
||||||
/// This `struct` is created by [`Iterator::intersperse_with`]. See its
|
/// This `struct` is created by [`Iterator::intersperse_with`]. See its
|
||||||
/// documentation for more information.
|
/// documentation for more information.
|
||||||
#[stable(feature = "iter_intersperse", since = "1.56.0")]
|
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
|
||||||
pub struct IntersperseWith<I, G>
|
pub struct IntersperseWith<I, G>
|
||||||
where
|
where
|
||||||
I: Iterator,
|
I: Iterator,
|
||||||
@ -71,7 +71,7 @@ where
|
|||||||
needs_sep: bool,
|
needs_sep: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "iter_intersperse", since = "1.56.0")]
|
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
|
||||||
impl<I, G> crate::fmt::Debug for IntersperseWith<I, G>
|
impl<I, G> crate::fmt::Debug for IntersperseWith<I, G>
|
||||||
where
|
where
|
||||||
I: Iterator + crate::fmt::Debug,
|
I: Iterator + crate::fmt::Debug,
|
||||||
@ -87,7 +87,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "iter_intersperse", since = "1.56.0")]
|
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
|
||||||
impl<I, G> crate::clone::Clone for IntersperseWith<I, G>
|
impl<I, G> crate::clone::Clone for IntersperseWith<I, G>
|
||||||
where
|
where
|
||||||
I: Iterator + crate::clone::Clone,
|
I: Iterator + crate::clone::Clone,
|
||||||
@ -113,7 +113,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "iter_intersperse", since = "1.56.0")]
|
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
|
||||||
impl<I, G> Iterator for IntersperseWith<I, G>
|
impl<I, G> Iterator for IntersperseWith<I, G>
|
||||||
where
|
where
|
||||||
I: Iterator,
|
I: Iterator,
|
||||||
|
@ -42,7 +42,7 @@ pub use self::flatten::Flatten;
|
|||||||
#[stable(feature = "iter_copied", since = "1.36.0")]
|
#[stable(feature = "iter_copied", since = "1.36.0")]
|
||||||
pub use self::copied::Copied;
|
pub use self::copied::Copied;
|
||||||
|
|
||||||
#[stable(feature = "iter_intersperse", since = "1.56.0")]
|
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
|
||||||
pub use self::intersperse::{Intersperse, IntersperseWith};
|
pub use self::intersperse::{Intersperse, IntersperseWith};
|
||||||
|
|
||||||
#[stable(feature = "iter_map_while", since = "1.57.0")]
|
#[stable(feature = "iter_map_while", since = "1.57.0")]
|
||||||
|
@ -414,7 +414,7 @@ pub use self::adapters::{
|
|||||||
Chain, Cycle, Enumerate, Filter, FilterMap, FlatMap, Fuse, Inspect, Map, Peekable, Rev, Scan,
|
Chain, Cycle, Enumerate, Filter, FilterMap, FlatMap, Fuse, Inspect, Map, Peekable, Rev, Scan,
|
||||||
Skip, SkipWhile, Take, TakeWhile, Zip,
|
Skip, SkipWhile, Take, TakeWhile, Zip,
|
||||||
};
|
};
|
||||||
#[stable(feature = "iter_intersperse", since = "1.56.0")]
|
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
|
||||||
pub use self::adapters::{Intersperse, IntersperseWith};
|
pub use self::adapters::{Intersperse, IntersperseWith};
|
||||||
|
|
||||||
pub(crate) use self::adapters::process_results;
|
pub(crate) use self::adapters::process_results;
|
||||||
|
@ -539,6 +539,8 @@ pub trait Iterator {
|
|||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// #![feature(iter_intersperse)]
|
||||||
|
///
|
||||||
/// let mut a = [0, 1, 2].iter().intersperse(&100);
|
/// let mut a = [0, 1, 2].iter().intersperse(&100);
|
||||||
/// assert_eq!(a.next(), Some(&0)); // The first element from `a`.
|
/// assert_eq!(a.next(), Some(&0)); // The first element from `a`.
|
||||||
/// assert_eq!(a.next(), Some(&100)); // The separator.
|
/// assert_eq!(a.next(), Some(&100)); // The separator.
|
||||||
@ -549,8 +551,9 @@ pub trait Iterator {
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// `intersperse` can be very useful to join an iterator's items using a common element:
|
/// `intersperse` can be very useful to join an iterator's items using a common element:
|
||||||
///
|
|
||||||
/// ```
|
/// ```
|
||||||
|
/// #![feature(iter_intersperse)]
|
||||||
|
///
|
||||||
/// let hello = ["Hello", "World", "!"].iter().copied().intersperse(" ").collect::<String>();
|
/// let hello = ["Hello", "World", "!"].iter().copied().intersperse(" ").collect::<String>();
|
||||||
/// assert_eq!(hello, "Hello World !");
|
/// assert_eq!(hello, "Hello World !");
|
||||||
/// ```
|
/// ```
|
||||||
@ -558,7 +561,7 @@ pub trait Iterator {
|
|||||||
/// [`Clone`]: crate::clone::Clone
|
/// [`Clone`]: crate::clone::Clone
|
||||||
/// [`intersperse_with`]: Iterator::intersperse_with
|
/// [`intersperse_with`]: Iterator::intersperse_with
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "iter_intersperse", since = "1.56.0")]
|
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
|
||||||
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
|
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
@ -583,6 +586,8 @@ pub trait Iterator {
|
|||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// #![feature(iter_intersperse)]
|
||||||
|
///
|
||||||
/// #[derive(PartialEq, Debug)]
|
/// #[derive(PartialEq, Debug)]
|
||||||
/// struct NotClone(usize);
|
/// struct NotClone(usize);
|
||||||
///
|
///
|
||||||
@ -599,8 +604,9 @@ pub trait Iterator {
|
|||||||
///
|
///
|
||||||
/// `intersperse_with` can be used in situations where the separator needs
|
/// `intersperse_with` can be used in situations where the separator needs
|
||||||
/// to be computed:
|
/// to be computed:
|
||||||
///
|
|
||||||
/// ```
|
/// ```
|
||||||
|
/// #![feature(iter_intersperse)]
|
||||||
|
///
|
||||||
/// let src = ["Hello", "to", "all", "people", "!!"].iter().copied();
|
/// let src = ["Hello", "to", "all", "people", "!!"].iter().copied();
|
||||||
///
|
///
|
||||||
/// // The closure mutably borrows its context to generate an item.
|
/// // The closure mutably borrows its context to generate an item.
|
||||||
@ -613,7 +619,7 @@ pub trait Iterator {
|
|||||||
/// [`Clone`]: crate::clone::Clone
|
/// [`Clone`]: crate::clone::Clone
|
||||||
/// [`intersperse`]: Iterator::intersperse
|
/// [`intersperse`]: Iterator::intersperse
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "iter_intersperse", since = "1.56.0")]
|
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
|
||||||
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
|
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#![feature(int_log)]
|
#![feature(int_log)]
|
||||||
#![feature(iter_advance_by)]
|
#![feature(iter_advance_by)]
|
||||||
#![feature(iter_partition_in_place)]
|
#![feature(iter_partition_in_place)]
|
||||||
|
#![feature(iter_intersperse)]
|
||||||
#![feature(iter_is_partitioned)]
|
#![feature(iter_is_partitioned)]
|
||||||
#![feature(iter_order_by)]
|
#![feature(iter_order_by)]
|
||||||
#![feature(const_mut_refs)]
|
#![feature(const_mut_refs)]
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![feature(once_cell)]
|
#![feature(once_cell)]
|
||||||
#![feature(type_ascription)]
|
#![feature(type_ascription)]
|
||||||
|
#![feature(iter_intersperse)]
|
||||||
#![recursion_limit = "256"]
|
#![recursion_limit = "256"]
|
||||||
#![warn(rustc::internal)]
|
#![warn(rustc::internal)]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user