Skip to content

Commit e19fc28

Browse files
Make iter::Empty<T> Send, Sync and Unpin for any T
1 parent ceb2512 commit e19fc28

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libcore/iter/sources.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ pub fn repeat_with<A, F: FnMut() -> A>(repeater: F) -> RepeatWith<F> {
198198
///
199199
/// [`empty`]: fn.empty.html
200200
#[stable(feature = "iter_empty", since = "1.2.0")]
201-
pub struct Empty<T>(marker::PhantomData<T>);
201+
pub struct Empty<T>(marker::PhantomData<PhantomFnWorkaround<T>>);
202+
203+
// Workaround for PhantomData<fn() -> T> not being allowed in const fn.
204+
struct PhantomFnWorkaround<T>(fn() -> T);
202205

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

0 commit comments

Comments
 (0)