Skip to content

Commit 8a44125

Browse files
committed
Auto merge of #60224 - Centril:rollup-lfuhhsk, r=Centril
Rollup of 5 pull requests Successful merges: - #56278 (Future-proof MIR for dedicated debuginfo.) - #59739 (Stabilize futures_api) - #59822 (Fix dark css rule) - #60186 (Temporarily accept [i|u][32|size] suffixes on a tuple index and warn) - #60190 (Don't generate unnecessary rmeta files.) Failed merges: r? @ghost
2 parents 0928511 + 7304e96 commit 8a44125

File tree

77 files changed

+567
-354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+567
-354
lines changed

src/liballoc/boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ impl<G: ?Sized + Generator> Generator for Pin<Box<G>> {
911911
}
912912
}
913913

914-
#[unstable(feature = "futures_api", issue = "50547")]
914+
#[stable(feature = "futures_api", since = "1.36.0")]
915915
impl<F: ?Sized + Future + Unpin> Future for Box<F> {
916916
type Output = F::Output;
917917

src/liballoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
#![feature(fmt_internals)]
8686
#![feature(fn_traits)]
8787
#![feature(fundamental)]
88-
#![feature(futures_api)]
8988
#![feature(lang_items)]
9089
#![feature(libc)]
9190
#![feature(needs_allocator)]

src/libcore/future/future.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#![unstable(feature = "futures_api",
2-
reason = "futures in libcore are unstable",
3-
issue = "50547")]
1+
#![stable(feature = "futures_api", since = "1.36.0")]
42

53
use crate::marker::Unpin;
64
use crate::ops;
@@ -26,8 +24,10 @@ use crate::task::{Context, Poll};
2624
/// `await!` the value.
2725
#[doc(spotlight)]
2826
#[must_use = "futures do nothing unless polled"]
27+
#[stable(feature = "futures_api", since = "1.36.0")]
2928
pub trait Future {
3029
/// The type of value produced on completion.
30+
#[stable(feature = "futures_api", since = "1.36.0")]
3131
type Output;
3232

3333
/// Attempt to resolve the future to a final value, registering
@@ -92,9 +92,11 @@ pub trait Future {
9292
/// [`Context`]: ../task/struct.Context.html
9393
/// [`Waker`]: ../task/struct.Waker.html
9494
/// [`Waker::wake`]: ../task/struct.Waker.html#method.wake
95+
#[stable(feature = "futures_api", since = "1.36.0")]
9596
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;
9697
}
9798

99+
#[stable(feature = "futures_api", since = "1.36.0")]
98100
impl<F: ?Sized + Future + Unpin> Future for &mut F {
99101
type Output = F::Output;
100102

@@ -103,6 +105,7 @@ impl<F: ?Sized + Future + Unpin> Future for &mut F {
103105
}
104106
}
105107

108+
#[stable(feature = "futures_api", since = "1.36.0")]
106109
impl<P> Future for Pin<P>
107110
where
108111
P: Unpin + ops::DerefMut,

src/libcore/future/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#![unstable(feature = "futures_api",
2-
reason = "futures in libcore are unstable",
3-
issue = "50547")]
1+
#![stable(feature = "futures_api", since = "1.36.0")]
42

53
//! Asynchronous values.
64
75
mod future;
6+
#[stable(feature = "futures_api", since = "1.36.0")]
87
pub use self::future::Future;

src/libcore/task/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#![unstable(feature = "futures_api",
2-
reason = "futures in libcore are unstable",
3-
issue = "50547")]
1+
#![stable(feature = "futures_api", since = "1.36.0")]
42

53
//! Types and Traits for working with asynchronous tasks.
64
75
mod poll;
6+
#[stable(feature = "futures_api", since = "1.36.0")]
87
pub use self::poll::Poll;
98

109
mod wake;
10+
#[stable(feature = "futures_api", since = "1.36.0")]
1111
pub use self::wake::{Context, Waker, RawWaker, RawWakerVTable};

src/libcore/task/poll.rs

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#![unstable(feature = "futures_api",
2-
reason = "futures in libcore are unstable",
3-
issue = "50547")]
1+
#![stable(feature = "futures_api", since = "1.36.0")]
42

53
use crate::ops::Try;
64
use crate::result::Result;
@@ -9,20 +7,27 @@ use crate::result::Result;
97
/// scheduled to receive a wakeup instead.
108
#[must_use = "this `Poll` may be a `Pending` variant, which should be handled"]
119
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
10+
#[stable(feature = "futures_api", since = "1.36.0")]
1211
pub enum Poll<T> {
1312
/// Represents that a value is immediately ready.
14-
Ready(T),
13+
#[stable(feature = "futures_api", since = "1.36.0")]
14+
Ready(
15+
#[stable(feature = "futures_api", since = "1.36.0")]
16+
T
17+
),
1518

1619
/// Represents that a value is not ready yet.
1720
///
1821
/// When a function returns `Pending`, the function *must* also
1922
/// ensure that the current task is scheduled to be awoken when
2023
/// progress can be made.
24+
#[stable(feature = "futures_api", since = "1.36.0")]
2125
Pending,
2226
}
2327

2428
impl<T> Poll<T> {
2529
/// Changes the ready value of this `Poll` with the closure provided.
30+
#[stable(feature = "futures_api", since = "1.36.0")]
2631
pub fn map<U, F>(self, f: F) -> Poll<U>
2732
where F: FnOnce(T) -> U
2833
{
@@ -34,6 +39,7 @@ impl<T> Poll<T> {
3439

3540
/// Returns `true` if this is `Poll::Ready`
3641
#[inline]
42+
#[stable(feature = "futures_api", since = "1.36.0")]
3743
pub fn is_ready(&self) -> bool {
3844
match *self {
3945
Poll::Ready(_) => true,
@@ -43,13 +49,15 @@ impl<T> Poll<T> {
4349

4450
/// Returns `true` if this is `Poll::Pending`
4551
#[inline]
52+
#[stable(feature = "futures_api", since = "1.36.0")]
4653
pub fn is_pending(&self) -> bool {
4754
!self.is_ready()
4855
}
4956
}
5057

5158
impl<T, E> Poll<Result<T, E>> {
5259
/// Changes the success value of this `Poll` with the closure provided.
60+
#[stable(feature = "futures_api", since = "1.36.0")]
5361
pub fn map_ok<U, F>(self, f: F) -> Poll<Result<U, E>>
5462
where F: FnOnce(T) -> U
5563
{
@@ -61,6 +69,7 @@ impl<T, E> Poll<Result<T, E>> {
6169
}
6270

6371
/// Changes the error value of this `Poll` with the closure provided.
72+
#[stable(feature = "futures_api", since = "1.36.0")]
6473
pub fn map_err<U, F>(self, f: F) -> Poll<Result<T, U>>
6574
where F: FnOnce(E) -> U
6675
{
@@ -72,12 +81,14 @@ impl<T, E> Poll<Result<T, E>> {
7281
}
7382
}
7483

84+
#[stable(feature = "futures_api", since = "1.36.0")]
7585
impl<T> From<T> for Poll<T> {
7686
fn from(t: T) -> Poll<T> {
7787
Poll::Ready(t)
7888
}
7989
}
8090

91+
#[stable(feature = "futures_api", since = "1.36.0")]
8192
impl<T, E> Try for Poll<Result<T, E>> {
8293
type Ok = Poll<T>;
8394
type Error = E;
@@ -102,6 +113,7 @@ impl<T, E> Try for Poll<Result<T, E>> {
102113
}
103114
}
104115

116+
#[stable(feature = "futures_api", since = "1.36.0")]
105117
impl<T, E> Try for Poll<Option<Result<T, E>>> {
106118
type Ok = Poll<Option<T>>;
107119
type Error = E;

src/libcore/task/wake.rs

+27-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#![unstable(feature = "futures_api",
2-
reason = "futures in libcore are unstable",
3-
issue = "50547")]
1+
#![stable(feature = "futures_api", since = "1.36.0")]
42

53
use crate::fmt;
64
use crate::marker::{PhantomData, Unpin};
@@ -13,6 +11,7 @@ use crate::marker::{PhantomData, Unpin};
1311
/// It consists of a data pointer and a [virtual function pointer table (vtable)][vtable] that
1412
/// customizes the behavior of the `RawWaker`.
1513
#[derive(PartialEq, Debug)]
14+
#[stable(feature = "futures_api", since = "1.36.0")]
1615
pub struct RawWaker {
1716
/// A data pointer, which can be used to store arbitrary data as required
1817
/// by the executor. This could be e.g. a type-erased pointer to an `Arc`
@@ -37,9 +36,7 @@ impl RawWaker {
3736
/// from a `RawWaker`. For each operation on the `Waker`, the associated
3837
/// function in the `vtable` of the underlying `RawWaker` will be called.
3938
#[rustc_promotable]
40-
#[unstable(feature = "futures_api",
41-
reason = "futures in libcore are unstable",
42-
issue = "50547")]
39+
#[stable(feature = "futures_api", since = "1.36.0")]
4340
pub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> RawWaker {
4441
RawWaker {
4542
data,
@@ -58,6 +55,7 @@ impl RawWaker {
5855
/// pointer of a properly constructed [`RawWaker`] object from inside the
5956
/// [`RawWaker`] implementation. Calling one of the contained functions using
6057
/// any other `data` pointer will cause undefined behavior.
58+
#[stable(feature = "futures_api", since = "1.36.0")]
6159
#[derive(PartialEq, Copy, Clone, Debug)]
6260
pub struct RawWakerVTable {
6361
/// This function will be called when the [`RawWaker`] gets cloned, e.g. when
@@ -131,9 +129,14 @@ impl RawWakerVTable {
131129
/// resources that are associated with this instance of a [`RawWaker`] and
132130
/// associated task.
133131
#[rustc_promotable]
134-
#[unstable(feature = "futures_api",
135-
reason = "futures in libcore are unstable",
136-
issue = "50547")]
132+
#[cfg_attr(stage0, unstable(feature = "futures_api_const_fn_ptr", issue = "50547"))]
133+
#[cfg_attr(not(stage0), stable(feature = "futures_api", since = "1.36.0"))]
134+
// `rustc_allow_const_fn_ptr` is a hack that should not be used anywhere else
135+
// without first consulting with T-Lang.
136+
//
137+
// FIXME: remove whenever we have a stable way to accept fn pointers from const fn
138+
// (see https://github.com/rust-rfcs/const-eval/issues/19#issuecomment-472799062)
139+
#[cfg_attr(not(stage0), rustc_allow_const_fn_ptr)]
137140
pub const fn new(
138141
clone: unsafe fn(*const ()) -> RawWaker,
139142
wake: unsafe fn(*const ()),
@@ -153,6 +156,7 @@ impl RawWakerVTable {
153156
///
154157
/// Currently, `Context` only serves to provide access to a `&Waker`
155158
/// which can be used to wake the current task.
159+
#[stable(feature = "futures_api", since = "1.36.0")]
156160
pub struct Context<'a> {
157161
waker: &'a Waker,
158162
// Ensure we future-proof against variance changes by forcing
@@ -164,6 +168,7 @@ pub struct Context<'a> {
164168

165169
impl<'a> Context<'a> {
166170
/// Create a new `Context` from a `&Waker`.
171+
#[stable(feature = "futures_api", since = "1.36.0")]
167172
#[inline]
168173
pub fn from_waker(waker: &'a Waker) -> Self {
169174
Context {
@@ -173,12 +178,14 @@ impl<'a> Context<'a> {
173178
}
174179

175180
/// Returns a reference to the `Waker` for the current task.
181+
#[stable(feature = "futures_api", since = "1.36.0")]
176182
#[inline]
177183
pub fn waker(&self) -> &'a Waker {
178184
&self.waker
179185
}
180186
}
181187

188+
#[stable(feature = "futures_api", since = "1.36.0")]
182189
impl fmt::Debug for Context<'_> {
183190
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
184191
f.debug_struct("Context")
@@ -195,17 +202,22 @@ impl fmt::Debug for Context<'_> {
195202
///
196203
/// Implements [`Clone`], [`Send`], and [`Sync`].
197204
#[repr(transparent)]
205+
#[stable(feature = "futures_api", since = "1.36.0")]
198206
pub struct Waker {
199207
waker: RawWaker,
200208
}
201209

210+
#[stable(feature = "futures_api", since = "1.36.0")]
202211
impl Unpin for Waker {}
212+
#[stable(feature = "futures_api", since = "1.36.0")]
203213
unsafe impl Send for Waker {}
214+
#[stable(feature = "futures_api", since = "1.36.0")]
204215
unsafe impl Sync for Waker {}
205216

206217
impl Waker {
207218
/// Wake up the task associated with this `Waker`.
208219
#[inline]
220+
#[stable(feature = "futures_api", since = "1.36.0")]
209221
pub fn wake(self) {
210222
// The actual wakeup call is delegated through a virtual function call
211223
// to the implementation which is defined by the executor.
@@ -227,6 +239,7 @@ impl Waker {
227239
/// where an owned `Waker` is available. This method should be preferred to
228240
/// calling `waker.clone().wake()`.
229241
#[inline]
242+
#[stable(feature = "futures_api", since = "1.36.0")]
230243
pub fn wake_by_ref(&self) {
231244
// The actual wakeup call is delegated through a virtual function call
232245
// to the implementation which is defined by the executor.
@@ -243,6 +256,7 @@ impl Waker {
243256
///
244257
/// This function is primarily used for optimization purposes.
245258
#[inline]
259+
#[stable(feature = "futures_api", since = "1.36.0")]
246260
pub fn will_wake(&self, other: &Waker) -> bool {
247261
self.waker == other.waker
248262
}
@@ -253,13 +267,15 @@ impl Waker {
253267
/// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld.
254268
/// Therefore this method is unsafe.
255269
#[inline]
270+
#[stable(feature = "futures_api", since = "1.36.0")]
256271
pub unsafe fn from_raw(waker: RawWaker) -> Waker {
257272
Waker {
258273
waker,
259274
}
260275
}
261276
}
262277

278+
#[stable(feature = "futures_api", since = "1.36.0")]
263279
impl Clone for Waker {
264280
#[inline]
265281
fn clone(&self) -> Self {
@@ -272,6 +288,7 @@ impl Clone for Waker {
272288
}
273289
}
274290

291+
#[stable(feature = "futures_api", since = "1.36.0")]
275292
impl Drop for Waker {
276293
#[inline]
277294
fn drop(&mut self) {
@@ -282,6 +299,7 @@ impl Drop for Waker {
282299
}
283300
}
284301

302+
#[stable(feature = "futures_api", since = "1.36.0")]
285303
impl fmt::Debug for Waker {
286304
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
287305
let vtable_ptr = self.waker.vtable as *const RawWakerVTable;

src/librustc/ich/impls_syntax.rs

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ impl_stable_hash_for!(struct ::syntax::attr::Stability {
121121
feature,
122122
rustc_depr,
123123
promotable,
124+
allow_const_fn_ptr,
124125
const_stability
125126
});
126127

src/librustc/middle/stability.rs

+1
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ impl<'a, 'tcx> Index<'tcx> {
441441
rustc_depr: None,
442442
const_stability: None,
443443
promotable: false,
444+
allow_const_fn_ptr: false,
444445
});
445446
annotator.parent_stab = Some(stability);
446447
}

0 commit comments

Comments
 (0)