Skip to content

Commit 731bbae

Browse files
committed
Also change PhantomData parameter of iter::Empty, and future::Pending
1 parent a043acd commit 731bbae

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

library/core/src/future/pending.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::task::{Context, Poll};
1212
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
1313
#[must_use = "futures do nothing unless you `.await` or poll them"]
1414
pub struct Pending<T> {
15-
_data: marker::PhantomData<T>,
15+
_data: marker::PhantomData<fn() -> T>,
1616
}
1717

1818
/// Creates a future which never resolves, representing a computation that never
@@ -43,9 +43,6 @@ impl<T> Future for Pending<T> {
4343
}
4444
}
4545

46-
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
47-
impl<T> Unpin for Pending<T> {}
48-
4946
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
5047
impl<T> Debug for Pending<T> {
5148
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ 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+
2530
/// An iterator that yields nothing.
2631
///
2732
/// This `struct` is created by the [`empty()`] function. See its documentation for more.
2833
#[must_use = "iterators are lazy and do nothing unless consumed"]
2934
#[stable(feature = "iter_empty", since = "1.2.0")]
30-
pub struct Empty<T>(marker::PhantomData<T>);
31-
32-
#[stable(feature = "iter_empty_send_sync", since = "1.42.0")]
33-
unsafe impl<T> Send for Empty<T> {}
34-
#[stable(feature = "iter_empty_send_sync", since = "1.42.0")]
35-
unsafe impl<T> Sync for Empty<T> {}
35+
pub struct Empty<T>(marker::PhantomData<FnReturning<T>>);
3636

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

0 commit comments

Comments
 (0)