Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
98c71c36
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,发现更多精彩内容 >>
提交
98c71c36
编写于
4月 18, 2019
作者:
V
varkor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Check async in trait methods
上级
93c4b1f4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
5 deletion
+29
-5
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+3
-0
src/test/ui/feature-gates/feature-gate-async-await.rs
src/test/ui/feature-gates/feature-gate-async-await.rs
+5
-0
src/test/ui/feature-gates/feature-gate-async-await.stderr
src/test/ui/feature-gates/feature-gate-async-await.stderr
+21
-5
未找到文件。
src/libsyntax/feature_gate.rs
浏览文件 @
98c71c36
...
...
@@ -2068,6 +2068,9 @@ fn visit_trait_item(&mut self, ti: &'a ast::TraitItem) {
if
block
.is_none
()
{
self
.check_abi
(
sig
.header.abi
,
ti
.span
);
}
if
sig
.header.asyncness.node
.is_async
()
{
gate_feature_post!
(
&
self
,
async_await
,
ti
.span
,
"async fn is unstable"
);
}
if
sig
.decl.c_variadic
{
gate_feature_post!
(
&
self
,
c_variadic
,
ti
.span
,
"C-variadic functions are unstable"
);
...
...
src/test/ui/feature-gates/feature-gate-async-await.rs
浏览文件 @
98c71c36
...
...
@@ -8,6 +8,11 @@ impl S {
async
fn
foo
()
{}
//~ ERROR async fn is unstable
}
trait
T
{
async
fn
foo
();
//~ ERROR trait fns cannot be declared `async`
//~^ ERROR async fn is unstable
}
async
fn
foo
()
{}
//~ ERROR async fn is unstable
fn
main
()
{
...
...
src/test/ui/feature-gates/feature-gate-async-await.stderr
浏览文件 @
98c71c36
error[E0706]: trait fns cannot be declared `async`
--> $DIR/feature-gate-async-await.rs:12:5
|
LL | async fn foo();
| ^^^^^^^^^^^^^^^
error[E0658]: async fn is unstable
--> $DIR/feature-gate-async-await.rs:8:5
|
...
...
@@ -8,7 +14,16 @@ 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:11:1
--> $DIR/feature-gate-async-await.rs:12:5
|
LL | async fn foo();
| ^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/50547
= help: add #![feature(async_await)] to the crate attributes to enable
error[E0658]: async fn is unstable
--> $DIR/feature-gate-async-await.rs:16:1
|
LL | async fn foo() {}
| ^^^^^^^^^^^^^^^^^
...
...
@@ -17,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
4
:13
--> $DIR/feature-gate-async-await.rs:1
9
:13
|
LL | let _ = async {};
| ^^^^^^^^
...
...
@@ -26,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:
15
:13
--> $DIR/feature-gate-async-await.rs:
20
:13
|
LL | let _ = async || {};
| ^^^^^^^^^^^
...
...
@@ -34,6 +49,7 @@ LL | let _ = async || {};
= note: for more information, see https://github.com/rust-lang/rust/issues/50547
= help: add #![feature(async_await)] to the crate attributes to enable
error: aborting due to
4
previous errors
error: aborting due to
6
previous errors
For more information about this error, try `rustc --explain E0658`.
Some errors occurred: E0658, E0706.
For more information about an error, try `rustc --explain E0658`.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录