Skip to content

Commit d1193ad

Browse files
authored
Rollup merge of #103945 - H4x5:remove-iter-empty-hack, r=compiler-errors
Remove `iter::Empty` hack `iter::Empty` uses a newtype to work around `#![feature(const_fn_fn_ptr_basics)]`, which has been stable since 1.61.0.
2 parents dc98aa6 + b473bc9 commit d1193ad

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

library/core/src/iter/sources/empty.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,12 @@ pub const fn empty<T>() -> Empty<T> {
2222
Empty(marker::PhantomData)
2323
}
2424

25-
// Newtype for use in `PhantomData` to avoid
26-
// > error: const-stable function cannot use `#[feature(const_fn_fn_ptr_basics)]`
27-
// in `const fn empty<T>()` above.
28-
struct FnReturning<T>(fn() -> T);
29-
3025
/// An iterator that yields nothing.
3126
///
3227
/// This `struct` is created by the [`empty()`] function. See its documentation for more.
3328
#[must_use = "iterators are lazy and do nothing unless consumed"]
3429
#[stable(feature = "iter_empty", since = "1.2.0")]
35-
pub struct Empty<T>(marker::PhantomData<FnReturning<T>>);
30+
pub struct Empty<T>(marker::PhantomData<fn() -> T>);
3631

3732
#[stable(feature = "core_impl_debug", since = "1.9.0")]
3833
impl<T> fmt::Debug for Empty<T> {

0 commit comments

Comments
 (0)