Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3f966dcd
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3f966dcd
编写于
4月 05, 2019
作者:
T
Taylor Cramer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Stabilize futures_api
上级
e617025e
变更
32
隐藏空白更改
内联
并排
Showing
32 changed file
with
86 addition
and
66 deletion
+86
-66
src/liballoc/boxed.rs
src/liballoc/boxed.rs
+1
-1
src/liballoc/lib.rs
src/liballoc/lib.rs
+0
-1
src/libcore/future/future.rs
src/libcore/future/future.rs
+6
-3
src/libcore/future/mod.rs
src/libcore/future/mod.rs
+2
-3
src/libcore/task/mod.rs
src/libcore/task/mod.rs
+3
-3
src/libcore/task/poll.rs
src/libcore/task/poll.rs
+16
-4
src/libcore/task/wake.rs
src/libcore/task/wake.rs
+27
-9
src/libstd/future.rs
src/libstd/future.rs
+1
-0
src/libstd/lib.rs
src/libstd/lib.rs
+3
-7
src/libstd/panic.rs
src/libstd/panic.rs
+1
-1
src/test/compile-fail/must_use-in-stdlib-traits.rs
src/test/compile-fail/must_use-in-stdlib-traits.rs
+1
-1
src/test/run-pass/async-await.rs
src/test/run-pass/async-await.rs
+1
-1
src/test/run-pass/auxiliary/arc_wake.rs
src/test/run-pass/auxiliary/arc_wake.rs
+0
-2
src/test/run-pass/futures-api.rs
src/test/run-pass/futures-api.rs
+0
-2
src/test/run-pass/issue-54716.rs
src/test/run-pass/issue-54716.rs
+1
-1
src/test/run-pass/issue-55809.rs
src/test/run-pass/issue-55809.rs
+1
-1
src/test/rustdoc/async-fn.rs
src/test/rustdoc/async-fn.rs
+1
-1
src/test/ui/async-fn-multiple-lifetimes.rs
src/test/ui/async-fn-multiple-lifetimes.rs
+1
-1
src/test/ui/consts/min_const_fn/allow_const_fn_ptr.stderr
src/test/ui/consts/min_const_fn/allow_const_fn_ptr.stderr
+2
-1
src/test/ui/editions/edition-deny-async-fns-2015.rs
src/test/ui/editions/edition-deny-async-fns-2015.rs
+1
-1
src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs
...ui/feature-gates/feature-gate-async-await-2015-edition.rs
+0
-2
src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr
...eature-gates/feature-gate-async-await-2015-edition.stderr
+4
-4
src/test/ui/feature-gates/feature-gate-async-await.rs
src/test/ui/feature-gates/feature-gate-async-await.rs
+0
-2
src/test/ui/feature-gates/feature-gate-async-await.stderr
src/test/ui/feature-gates/feature-gate-async-await.stderr
+6
-6
src/test/ui/impl-trait/recursive-async-impl-trait-type.rs
src/test/ui/impl-trait/recursive-async-impl-trait-type.rs
+1
-1
src/test/ui/impl-trait/recursive-impl-trait-type.rs
src/test/ui/impl-trait/recursive-impl-trait-type.rs
+1
-1
src/test/ui/issues/issue-54974.rs
src/test/ui/issues/issue-54974.rs
+1
-1
src/test/ui/issues/issue-55324.rs
src/test/ui/issues/issue-55324.rs
+1
-1
src/test/ui/issues/issue-58885.rs
src/test/ui/issues/issue-58885.rs
+1
-1
src/test/ui/issues/issue-59001.rs
src/test/ui/issues/issue-59001.rs
+1
-1
src/test/ui/no-args-non-move-async-closure.rs
src/test/ui/no-args-non-move-async-closure.rs
+1
-1
src/test/ui/try-poll.rs
src/test/ui/try-poll.rs
+0
-1
未找到文件。
src/liballoc/boxed.rs
浏览文件 @
3f966dcd
...
...
@@ -911,7 +911,7 @@ fn resume(mut self: Pin<&mut Self>) -> GeneratorState<Self::Yield, Self::Return>
}
}
#[
unstable(feature
=
"futures_api"
,
issue
=
"50547
"
)]
#[
stable(feature
=
"futures_api"
,
since
=
"1.36.0
"
)]
impl
<
F
:
?
Sized
+
Future
+
Unpin
>
Future
for
Box
<
F
>
{
type
Output
=
F
::
Output
;
...
...
src/liballoc/lib.rs
浏览文件 @
3f966dcd
...
...
@@ -85,7 +85,6 @@
#![feature(fmt_internals)]
#![feature(fn_traits)]
#![feature(fundamental)]
#![feature(futures_api)]
#![feature(lang_items)]
#![feature(libc)]
#![feature(needs_allocator)]
...
...
src/libcore/future/future.rs
浏览文件 @
3f966dcd
#![unstable(feature
=
"futures_api"
,
reason
=
"futures in libcore are unstable"
,
issue
=
"50547"
)]
#![stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
use
crate
::
marker
::
Unpin
;
use
crate
::
ops
;
...
...
@@ -26,8 +24,10 @@
/// `await!` the value.
#[doc(spotlight)]
#[must_use
=
"futures do nothing unless polled"
]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
trait
Future
{
/// The type of value produced on completion.
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
type
Output
;
/// Attempt to resolve the future to a final value, registering
...
...
@@ -92,9 +92,11 @@ pub trait Future {
/// [`Context`]: ../task/struct.Context.html
/// [`Waker`]: ../task/struct.Waker.html
/// [`Waker::wake`]: ../task/struct.Waker.html#method.wake
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
fn
poll
(
self
:
Pin
<&
mut
Self
>
,
cx
:
&
mut
Context
<
'_
>
)
->
Poll
<
Self
::
Output
>
;
}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
impl
<
F
:
?
Sized
+
Future
+
Unpin
>
Future
for
&
mut
F
{
type
Output
=
F
::
Output
;
...
...
@@ -103,6 +105,7 @@ fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
}
}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
impl
<
P
>
Future
for
Pin
<
P
>
where
P
:
Unpin
+
ops
::
DerefMut
,
...
...
src/libcore/future/mod.rs
浏览文件 @
3f966dcd
#![unstable(feature
=
"futures_api"
,
reason
=
"futures in libcore are unstable"
,
issue
=
"50547"
)]
#![stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
//! Asynchronous values.
mod
future
;
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
use
self
::
future
::
Future
;
src/libcore/task/mod.rs
浏览文件 @
3f966dcd
#![unstable(feature
=
"futures_api"
,
reason
=
"futures in libcore are unstable"
,
issue
=
"50547"
)]
#![stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
//! Types and Traits for working with asynchronous tasks.
mod
poll
;
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
use
self
::
poll
::
Poll
;
mod
wake
;
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
use
self
::
wake
::{
Context
,
Waker
,
RawWaker
,
RawWakerVTable
};
src/libcore/task/poll.rs
浏览文件 @
3f966dcd
#![unstable(feature
=
"futures_api"
,
reason
=
"futures in libcore are unstable"
,
issue
=
"50547"
)]
#![stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
use
crate
::
ops
::
Try
;
use
crate
::
result
::
Result
;
...
...
@@ -9,20 +7,27 @@
/// scheduled to receive a wakeup instead.
#[must_use
=
"this `Poll` may be a `Pending` variant, which should be handled"
]
#[derive(Copy,
Clone,
Debug,
Eq,
PartialEq,
Ord,
PartialOrd,
Hash)]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
enum
Poll
<
T
>
{
/// Represents that a value is immediately ready.
Ready
(
T
),
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
Ready
(
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
T
),
/// Represents that a value is not ready yet.
///
/// When a function returns `Pending`, the function *must* also
/// ensure that the current task is scheduled to be awoken when
/// progress can be made.
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
Pending
,
}
impl
<
T
>
Poll
<
T
>
{
/// Changes the ready value of this `Poll` with the closure provided.
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
fn
map
<
U
,
F
>
(
self
,
f
:
F
)
->
Poll
<
U
>
where
F
:
FnOnce
(
T
)
->
U
{
...
...
@@ -34,6 +39,7 @@ pub fn map<U, F>(self, f: F) -> Poll<U>
/// Returns `true` if this is `Poll::Ready`
#[inline]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
fn
is_ready
(
&
self
)
->
bool
{
match
*
self
{
Poll
::
Ready
(
_
)
=>
true
,
...
...
@@ -43,6 +49,7 @@ pub fn is_ready(&self) -> bool {
/// Returns `true` if this is `Poll::Pending`
#[inline]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
fn
is_pending
(
&
self
)
->
bool
{
!
self
.is_ready
()
}
...
...
@@ -50,6 +57,7 @@ pub fn is_pending(&self) -> bool {
impl
<
T
,
E
>
Poll
<
Result
<
T
,
E
>>
{
/// Changes the success value of this `Poll` with the closure provided.
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
fn
map_ok
<
U
,
F
>
(
self
,
f
:
F
)
->
Poll
<
Result
<
U
,
E
>>
where
F
:
FnOnce
(
T
)
->
U
{
...
...
@@ -61,6 +69,7 @@ pub fn map_ok<U, F>(self, f: F) -> Poll<Result<U, E>>
}
/// Changes the error value of this `Poll` with the closure provided.
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
fn
map_err
<
U
,
F
>
(
self
,
f
:
F
)
->
Poll
<
Result
<
T
,
U
>>
where
F
:
FnOnce
(
E
)
->
U
{
...
...
@@ -72,12 +81,14 @@ pub fn map_err<U, F>(self, f: F) -> Poll<Result<T, U>>
}
}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
impl
<
T
>
From
<
T
>
for
Poll
<
T
>
{
fn
from
(
t
:
T
)
->
Poll
<
T
>
{
Poll
::
Ready
(
t
)
}
}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
impl
<
T
,
E
>
Try
for
Poll
<
Result
<
T
,
E
>>
{
type
Ok
=
Poll
<
T
>
;
type
Error
=
E
;
...
...
@@ -102,6 +113,7 @@ fn from_ok(x: Self::Ok) -> Self {
}
}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
impl
<
T
,
E
>
Try
for
Poll
<
Option
<
Result
<
T
,
E
>>>
{
type
Ok
=
Poll
<
Option
<
T
>>
;
type
Error
=
E
;
...
...
src/libcore/task/wake.rs
浏览文件 @
3f966dcd
#![unstable(feature
=
"futures_api"
,
reason
=
"futures in libcore are unstable"
,
issue
=
"50547"
)]
#![stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
use
crate
::
fmt
;
use
crate
::
marker
::{
PhantomData
,
Unpin
};
...
...
@@ -13,6 +11,7 @@
/// It consists of a data pointer and a [virtual function pointer table (vtable)][vtable] that
/// customizes the behavior of the `RawWaker`.
#[derive(PartialEq,
Debug)]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
struct
RawWaker
{
/// A data pointer, which can be used to store arbitrary data as required
/// by the executor. This could be e.g. a type-erased pointer to an `Arc`
...
...
@@ -37,9 +36,7 @@ impl RawWaker {
/// from a `RawWaker`. For each operation on the `Waker`, the associated
/// function in the `vtable` of the underlying `RawWaker` will be called.
#[rustc_promotable]
#[unstable(feature
=
"futures_api"
,
reason
=
"futures in libcore are unstable"
,
issue
=
"50547"
)]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
const
fn
new
(
data
:
*
const
(),
vtable
:
&
'static
RawWakerVTable
)
->
RawWaker
{
RawWaker
{
data
,
...
...
@@ -58,6 +55,7 @@ pub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> RawWaker {
/// pointer of a properly constructed [`RawWaker`] object from inside the
/// [`RawWaker`] implementation. Calling one of the contained functions using
/// any other `data` pointer will cause undefined behavior.
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
#[derive(PartialEq,
Copy,
Clone,
Debug)]
pub
struct
RawWakerVTable
{
/// This function will be called when the [`RawWaker`] gets cloned, e.g. when
...
...
@@ -131,9 +129,14 @@ impl RawWakerVTable {
/// resources that are associated with this instance of a [`RawWaker`] and
/// associated task.
#[rustc_promotable]
#[unstable(feature
=
"futures_api"
,
reason
=
"futures in libcore are unstable"
,
issue
=
"50547"
)]
#[cfg_attr(stage0,
unstable(feature
=
"futures_api_const_fn_ptr"
,
issue
=
"50547"
))]
#[cfg_attr(not(stage0),
stable(feature
=
"futures_api"
,
since
=
"1.36.0"
))]
// `rustc_allow_const_fn_ptr` is a hack that should not be used anywhere else
// without first consulting with T-Lang.
//
// FIXME: remove whenever we have a stable way to accept fn pointers from const fn
// (see https://github.com/rust-rfcs/const-eval/issues/19#issuecomment-472799062)
#[cfg_attr(not(stage0),
rustc_allow_const_fn_ptr)]
pub
const
fn
new
(
clone
:
unsafe
fn
(
*
const
())
->
RawWaker
,
wake
:
unsafe
fn
(
*
const
()),
...
...
@@ -153,6 +156,7 @@ pub const fn new(
///
/// Currently, `Context` only serves to provide access to a `&Waker`
/// which can be used to wake the current task.
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
struct
Context
<
'a
>
{
waker
:
&
'a
Waker
,
// Ensure we future-proof against variance changes by forcing
...
...
@@ -164,6 +168,7 @@ pub struct Context<'a> {
impl
<
'a
>
Context
<
'a
>
{
/// Create a new `Context` from a `&Waker`.
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
#[inline]
pub
fn
from_waker
(
waker
:
&
'a
Waker
)
->
Self
{
Context
{
...
...
@@ -173,12 +178,14 @@ pub fn from_waker(waker: &'a Waker) -> Self {
}
/// Returns a reference to the `Waker` for the current task.
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
#[inline]
pub
fn
waker
(
&
self
)
->
&
'a
Waker
{
&
self
.waker
}
}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
impl
fmt
::
Debug
for
Context
<
'_
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
<
'_
>
)
->
fmt
::
Result
{
f
.debug_struct
(
"Context"
)
...
...
@@ -195,17 +202,22 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
///
/// Implements [`Clone`], [`Send`], and [`Sync`].
#[repr(transparent)]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
struct
Waker
{
waker
:
RawWaker
,
}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
impl
Unpin
for
Waker
{}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
unsafe
impl
Send
for
Waker
{}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
unsafe
impl
Sync
for
Waker
{}
impl
Waker
{
/// Wake up the task associated with this `Waker`.
#[inline]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
fn
wake
(
self
)
{
// The actual wakeup call is delegated through a virtual function call
// to the implementation which is defined by the executor.
...
...
@@ -227,6 +239,7 @@ pub fn wake(self) {
/// where an owned `Waker` is available. This method should be preferred to
/// calling `waker.clone().wake()`.
#[inline]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
fn
wake_by_ref
(
&
self
)
{
// The actual wakeup call is delegated through a virtual function call
// to the implementation which is defined by the executor.
...
...
@@ -243,6 +256,7 @@ pub fn wake_by_ref(&self) {
///
/// This function is primarily used for optimization purposes.
#[inline]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
fn
will_wake
(
&
self
,
other
:
&
Waker
)
->
bool
{
self
.waker
==
other
.waker
}
...
...
@@ -253,6 +267,7 @@ pub fn will_wake(&self, other: &Waker) -> bool {
/// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld.
/// Therefore this method is unsafe.
#[inline]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
unsafe
fn
from_raw
(
waker
:
RawWaker
)
->
Waker
{
Waker
{
waker
,
...
...
@@ -260,6 +275,7 @@ pub unsafe fn from_raw(waker: RawWaker) -> Waker {
}
}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
impl
Clone
for
Waker
{
#[inline]
fn
clone
(
&
self
)
->
Self
{
...
...
@@ -272,6 +288,7 @@ fn clone(&self) -> Self {
}
}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
impl
Drop
for
Waker
{
#[inline]
fn
drop
(
&
mut
self
)
{
...
...
@@ -282,6 +299,7 @@ fn drop(&mut self) {
}
}
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
impl
fmt
::
Debug
for
Waker
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
<
'_
>
)
->
fmt
::
Result
{
let
vtable_ptr
=
self
.waker.vtable
as
*
const
RawWakerVTable
;
...
...
src/libstd/future.rs
浏览文件 @
3f966dcd
...
...
@@ -9,6 +9,7 @@
use
core
::
ops
::{
Drop
,
Generator
,
GeneratorState
};
#[doc(inline)]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
use
core
::
future
::
*
;
/// Wrap a generator in a future.
...
...
src/libstd/lib.rs
浏览文件 @
3f966dcd
...
...
@@ -263,7 +263,6 @@
#![feature(fixed_size_array)]
#![feature(fn_traits)]
#![feature(fnbox)]
#![feature(futures_api)]
#![feature(generator_trait)]
#![feature(hash_raw_entry)]
#![feature(hashmap_internals)]
...
...
@@ -458,18 +457,15 @@
pub
mod
sync
;
pub
mod
time
;
#[unstable(feature
=
"futures_api"
,
reason
=
"futures in libcore are unstable"
,
issue
=
"50547"
)]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
mod
task
{
//! Types and Traits for working with asynchronous tasks.
#[doc(inline)]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
use
core
::
task
::
*
;
}
#[unstable(feature
=
"futures_api"
,
reason
=
"futures in libcore are unstable"
,
issue
=
"50547"
)]
#[stable(feature
=
"futures_api"
,
since
=
"1.36.0"
)]
pub
mod
future
;
// Platform-abstraction modules
...
...
src/libstd/panic.rs
浏览文件 @
3f966dcd
...
...
@@ -319,7 +319,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
#[
unstable(feature
=
"futures_api"
,
issue
=
"50547
"
)]
#[
stable(feature
=
"futures_api"
,
since
=
"1.36.0
"
)]
impl
<
F
:
Future
>
Future
for
AssertUnwindSafe
<
F
>
{
type
Output
=
F
::
Output
;
...
...
src/test/compile-fail/must_use-in-stdlib-traits.rs
浏览文件 @
3f966dcd
#![deny(unused_must_use)]
#![feature(arbitrary_self_types
,
futures_api
)]
#![feature(arbitrary_self_types)]
use
std
::
iter
::
Iterator
;
use
std
::
future
::
Future
;
...
...
src/test/run-pass/async-await.rs
浏览文件 @
3f966dcd
// edition:2018
// aux-build:arc_wake.rs
#![feature(async_await,
await_macro
,
futures_api
)]
#![feature(async_await,
await_macro)]
extern
crate
arc_wake
;
...
...
src/test/run-pass/auxiliary/arc_wake.rs
浏览文件 @
3f966dcd
// edition:2018
#![feature(futures_api)]
use
std
::
sync
::
Arc
;
use
std
::
task
::{
Waker
,
RawWaker
,
RawWakerVTable
,
...
...
src/test/run-pass/futures-api.rs
浏览文件 @
3f966dcd
// aux-build:arc_wake.rs
#![feature(futures_api)]
extern
crate
arc_wake
;
use
std
::
future
::
Future
;
...
...
src/test/run-pass/issue-54716.rs
浏览文件 @
3f966dcd
...
...
@@ -3,7 +3,7 @@
// run-pass
#![allow(unused_variables)]
#![feature(async_await,
await_macro
,
futures_api
)]
#![feature(async_await,
await_macro)]
extern
crate
arc_wake
;
...
...
src/test/run-pass/issue-55809.rs
浏览文件 @
3f966dcd
// edition:2018
// run-pass
#![feature(async_await,
await_macro
,
futures_api
)]
#![feature(async_await,
await_macro)]
trait
Foo
{
}
...
...
src/test/rustdoc/async-fn.rs
浏览文件 @
3f966dcd
// edition:2018
#![feature(async_await
,
futures_api
)]
#![feature(async_await)]
// @has async_fn/fn.foo.html '//pre[@class="rust fn"]' 'pub async fn foo() -> Option<Foo>'
pub
async
fn
foo
()
->
Option
<
Foo
>
{
...
...
src/test/ui/async-fn-multiple-lifetimes.rs
浏览文件 @
3f966dcd
// edition:2018
#![feature(arbitrary_self_types,
async_await,
await_macro,
futures_api,
pin)]
#![feature(arbitrary_self_types,
async_await,
await_macro,
pin)]
use
std
::
ops
::
Add
;
...
...
src/test/ui/consts/min_const_fn/allow_const_fn_ptr.stderr
浏览文件 @
3f966dcd
error[E0723]: function pointers in const fn are unstable
(see issue #57563)
error[E0723]: function pointers in const fn are unstable
--> $DIR/allow_const_fn_ptr.rs:4:16
|
LL | const fn error(_: fn()) {}
| ^
|
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
= help: add #![feature(const_fn)] to the crate attributes to enable
error: aborting due to previous error
...
...
src/test/ui/editions/edition-deny-async-fns-2015.rs
浏览文件 @
3f966dcd
// edition:2015
#![feature(
futures_api,
async_await)]
#![feature(async_await)]
async
fn
foo
()
{}
//~ ERROR `async fn` is not permitted in the 2015 edition
...
...
src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs
浏览文件 @
3f966dcd
// edition:2015
#![feature(futures_api)]
async
fn
foo
()
{}
//~ ERROR `async fn` is not permitted in the 2015 edition
//~^ ERROR async fn is unstable
...
...
src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr
浏览文件 @
3f966dcd
error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/feature-gate-async-await-2015-edition.rs:
5
:1
--> $DIR/feature-gate-async-await-2015-edition.rs:
3
:1
|
LL | async fn foo() {}
| ^^^^^
error[E0422]: cannot find struct, variant or union type `async` in this scope
--> $DIR/feature-gate-async-await-2015-edition.rs:
9
:13
--> $DIR/feature-gate-async-await-2015-edition.rs:
7
:13
|
LL | let _ = async {};
| ^^^^^ not found in this scope
error[E0425]: cannot find value `async` in this scope
--> $DIR/feature-gate-async-await-2015-edition.rs:
10
:13
--> $DIR/feature-gate-async-await-2015-edition.rs:
8
:13
|
LL | let _ = async || { true };
| ^^^^^ not found in this scope
error[E0658]: async fn is unstable
--> $DIR/feature-gate-async-await-2015-edition.rs:
5
:1
--> $DIR/feature-gate-async-await-2015-edition.rs:
3
:1
|
LL | async fn foo() {}
| ^^^^^^^^^^^^^^^^^
...
...
src/test/ui/feature-gates/feature-gate-async-await.rs
浏览文件 @
3f966dcd
// edition:2018
#![feature(futures_api)]
struct
S
;
impl
S
{
...
...
src/test/ui/feature-gates/feature-gate-async-await.stderr
浏览文件 @
3f966dcd
error[E0706]: trait fns cannot be declared `async`
--> $DIR/feature-gate-async-await.rs:1
2
:5
--> $DIR/feature-gate-async-await.rs:1
0
:5
|
LL | async fn foo();
| ^^^^^^^^^^^^^^^
error[E0658]: async fn is unstable
--> $DIR/feature-gate-async-await.rs:
8
:5
--> $DIR/feature-gate-async-await.rs:
6
:5
|
LL | async fn foo() {}
| ^^^^^^^^^^^^^^^^^
...
...
@@ -14,7 +14,7 @@ LL | async fn foo() {}
= help: add #![feature(async_await)] to the crate attributes to enable
error[E0658]: async fn is unstable
--> $DIR/feature-gate-async-await.rs:1
2
:5
--> $DIR/feature-gate-async-await.rs:1
0
:5
|
LL | async fn foo();
| ^^^^^^^^^^^^^^^
...
...
@@ -23,7 +23,7 @@ LL | async fn foo();
= help: add #![feature(async_await)] to the crate attributes to enable
error[E0658]: async fn is unstable
--> $DIR/feature-gate-async-await.rs:1
6
:1
--> $DIR/feature-gate-async-await.rs:1
4
:1
|
LL | async fn foo() {}
| ^^^^^^^^^^^^^^^^^
...
...
@@ -32,7 +32,7 @@ LL | async fn foo() {}
= help: add #![feature(async_await)] to the crate attributes to enable
error[E0658]: async blocks are unstable
--> $DIR/feature-gate-async-await.rs:1
9
:13
--> $DIR/feature-gate-async-await.rs:1
7
:13
|
LL | let _ = async {};
| ^^^^^^^^
...
...
@@ -41,7 +41,7 @@ LL | let _ = async {};
= help: add #![feature(async_await)] to the crate attributes to enable
error[E0658]: async closures are unstable
--> $DIR/feature-gate-async-await.rs:
20
:13
--> $DIR/feature-gate-async-await.rs:
18
:13
|
LL | let _ = async || {};
| ^^^^^^^^^^^
...
...
src/test/ui/impl-trait/recursive-async-impl-trait-type.rs
浏览文件 @
3f966dcd
...
...
@@ -2,7 +2,7 @@
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden when using `async` and `await`.
#![feature(await_macro,
async_await,
futures_api,
generators)]
#![feature(await_macro,
async_await,
generators)]
async
fn
recursive_async_function
()
->
()
{
//~ ERROR
await
!
(
recursive_async_function
());
...
...
src/test/ui/impl-trait/recursive-impl-trait-type.rs
浏览文件 @
3f966dcd
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden.
#![feature(
futures_api,
generators)]
#![feature(generators)]
fn
option
(
i
:
i32
)
->
impl
Sized
{
//~ ERROR
if
i
<
0
{
...
...
src/test/ui/issues/issue-54974.rs
浏览文件 @
3f966dcd
// compile-pass
// edition:2018
#![feature(async_await,
await_macro
,
futures_api
)]
#![feature(async_await,
await_macro)]
use
std
::
sync
::
Arc
;
...
...
src/test/ui/issues/issue-55324.rs
浏览文件 @
3f966dcd
// compile-pass
// edition:2018
#![feature(async_await,
await_macro
,
futures_api
)]
#![feature(async_await,
await_macro)]
use
std
::
future
::
Future
;
...
...
src/test/ui/issues/issue-58885.rs
浏览文件 @
3f966dcd
// compile-pass
// edition:2018
#![feature(async_await,
await_macro
,
futures_api
)]
#![feature(async_await,
await_macro)]
struct
Xyz
{
a
:
u64
,
...
...
src/test/ui/issues/issue-59001.rs
浏览文件 @
3f966dcd
// compile-pass
// edition:2018
#![feature(async_await,
await_macro
,
futures_api
)]
#![feature(async_await,
await_macro)]
use
std
::
future
::
Future
;
...
...
src/test/ui/no-args-non-move-async-closure.rs
浏览文件 @
3f966dcd
// edition:2018
#![feature(a
rbitrary_self_types,
async_await,
await_macro,
futures_api,
pin
)]
#![feature(a
sync_await,
await_macro
)]
fn
main
()
{
let
_
=
async
|
x
:
u8
|
{};
...
...
src/test/ui/try-poll.rs
浏览文件 @
3f966dcd
// compile-pass
#![allow(dead_code,
unused)]
#![feature(futures_api)]
use
std
::
task
::
Poll
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录