Skip to content

Commit a173c52

Browse files
compiler-errorsgitbot
authored and
gitbot
committed
Stabilize async closures
1 parent 4d14add commit a173c52

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

alloc/src/boxed.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,8 @@ impl<Args: Tuple, F: Fn<Args> + ?Sized, A: Allocator> Fn<Args> for Box<F, A> {
19851985
}
19861986
}
19871987

1988-
#[unstable(feature = "async_fn_traits", issue = "none")]
1988+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
1989+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
19891990
impl<Args: Tuple, F: AsyncFnOnce<Args> + ?Sized, A: Allocator> AsyncFnOnce<Args> for Box<F, A> {
19901991
type Output = F::Output;
19911992
type CallOnceFuture = F::CallOnceFuture;
@@ -1995,7 +1996,8 @@ impl<Args: Tuple, F: AsyncFnOnce<Args> + ?Sized, A: Allocator> AsyncFnOnce<Args>
19951996
}
19961997
}
19971998

1998-
#[unstable(feature = "async_fn_traits", issue = "none")]
1999+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
2000+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
19992001
impl<Args: Tuple, F: AsyncFnMut<Args> + ?Sized, A: Allocator> AsyncFnMut<Args> for Box<F, A> {
20002002
type CallRefFuture<'a>
20012003
= F::CallRefFuture<'a>
@@ -2007,7 +2009,8 @@ impl<Args: Tuple, F: AsyncFnMut<Args> + ?Sized, A: Allocator> AsyncFnMut<Args> f
20072009
}
20082010
}
20092011

2010-
#[unstable(feature = "async_fn_traits", issue = "none")]
2012+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
2013+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
20112014
impl<Args: Tuple, F: AsyncFn<Args> + ?Sized, A: Allocator> AsyncFn<Args> for Box<F, A> {
20122015
extern "rust-call" fn async_call(&self, args: Args) -> Self::CallRefFuture<'_> {
20132016
F::async_call(self, args)

alloc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
//
9292
// Library features:
9393
// tidy-alphabetical-start
94+
#![cfg_attr(bootstrap, feature(async_closure))]
9495
#![cfg_attr(test, feature(str_as_str))]
9596
#![feature(alloc_layout_extra)]
9697
#![feature(allocator_api)]
@@ -99,7 +100,6 @@
99100
#![feature(array_windows)]
100101
#![feature(ascii_char)]
101102
#![feature(assert_matches)]
102-
#![feature(async_closure)]
103103
#![feature(async_fn_traits)]
104104
#![feature(async_iterator)]
105105
#![feature(box_uninit_write)]

core/src/ops/async_function.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use crate::marker::Tuple;
44
/// An async-aware version of the [`Fn`](crate::ops::Fn) trait.
55
///
66
/// All `async fn` and functions returning futures implement this trait.
7-
#[unstable(feature = "async_closure", issue = "62290")]
7+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
8+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
89
#[rustc_paren_sugar]
910
#[fundamental]
1011
#[must_use = "async closures are lazy and do nothing unless called"]
@@ -18,7 +19,8 @@ pub trait AsyncFn<Args: Tuple>: AsyncFnMut<Args> {
1819
/// An async-aware version of the [`FnMut`](crate::ops::FnMut) trait.
1920
///
2021
/// All `async fn` and functions returning futures implement this trait.
21-
#[unstable(feature = "async_closure", issue = "62290")]
22+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
23+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
2224
#[rustc_paren_sugar]
2325
#[fundamental]
2426
#[must_use = "async closures are lazy and do nothing unless called"]
@@ -39,7 +41,8 @@ pub trait AsyncFnMut<Args: Tuple>: AsyncFnOnce<Args> {
3941
/// An async-aware version of the [`FnOnce`](crate::ops::FnOnce) trait.
4042
///
4143
/// All `async fn` and functions returning futures implement this trait.
42-
#[unstable(feature = "async_closure", issue = "62290")]
44+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
45+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
4346
#[rustc_paren_sugar]
4447
#[fundamental]
4548
#[must_use = "async closures are lazy and do nothing unless called"]
@@ -64,7 +67,8 @@ mod impls {
6467
use super::{AsyncFn, AsyncFnMut, AsyncFnOnce};
6568
use crate::marker::Tuple;
6669

67-
#[unstable(feature = "async_fn_traits", issue = "none")]
70+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
71+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
6872
impl<A: Tuple, F: ?Sized> AsyncFn<A> for &F
6973
where
7074
F: AsyncFn<A>,
@@ -74,7 +78,8 @@ mod impls {
7478
}
7579
}
7680

77-
#[unstable(feature = "async_fn_traits", issue = "none")]
81+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
82+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
7883
impl<A: Tuple, F: ?Sized> AsyncFnMut<A> for &F
7984
where
8085
F: AsyncFn<A>,
@@ -89,7 +94,8 @@ mod impls {
8994
}
9095
}
9196

92-
#[unstable(feature = "async_fn_traits", issue = "none")]
97+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
98+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
9399
impl<'a, A: Tuple, F: ?Sized> AsyncFnOnce<A> for &'a F
94100
where
95101
F: AsyncFn<A>,
@@ -102,7 +108,8 @@ mod impls {
102108
}
103109
}
104110

105-
#[unstable(feature = "async_fn_traits", issue = "none")]
111+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
112+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
106113
impl<A: Tuple, F: ?Sized> AsyncFnMut<A> for &mut F
107114
where
108115
F: AsyncFnMut<A>,
@@ -117,7 +124,8 @@ mod impls {
117124
}
118125
}
119126

120-
#[unstable(feature = "async_fn_traits", issue = "none")]
127+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
128+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
121129
impl<'a, A: Tuple, F: ?Sized> AsyncFnOnce<A> for &'a mut F
122130
where
123131
F: AsyncFnMut<A>,

std/src/prelude/common.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ pub use crate::marker::{Send, Sized, Sync, Unpin};
1212
#[stable(feature = "rust1", since = "1.0.0")]
1313
#[doc(no_inline)]
1414
pub use crate::ops::{Drop, Fn, FnMut, FnOnce};
15-
#[unstable(feature = "async_closure", issue = "62290")]
15+
#[cfg_attr(bootstrap, unstable(feature = "async_closure", issue = "62290"))]
16+
#[cfg_attr(not(bootstrap), stable(feature = "async_closure", since = "CURRENT_RUSTC_VERSION"))]
1617
#[doc(no_inline)]
1718
pub use crate::ops::{AsyncFn, AsyncFnMut, AsyncFnOnce};
1819

0 commit comments

Comments
 (0)