Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
4f0b4f26
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,发现更多精彩内容 >>
提交
4f0b4f26
编写于
12月 03, 2017
作者:
A
Alex Burka
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature gate trait aliases
上级
4029a019
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
14 deletion
+26
-14
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+8
-0
src/test/compile-fail/trait-alias.rs
src/test/compile-fail/trait-alias.rs
+4
-2
src/test/ui/trait-alias.rs
src/test/ui/trait-alias.rs
+2
-0
src/test/ui/trait-alias.stderr
src/test/ui/trait-alias.stderr
+12
-12
未找到文件。
src/libsyntax/feature_gate.rs
浏览文件 @
4f0b4f26
...
...
@@ -368,6 +368,8 @@ pub fn new() -> Features {
// Generators
(
active
,
generators
,
"1.21.0"
,
None
),
// Trait aliases
(
active
,
trait_alias
,
"1.24.0"
,
Some
(
41517
)),
// global allocators and their internals
(
active
,
global_allocator
,
"1.20.0"
,
None
),
...
...
@@ -1406,6 +1408,12 @@ fn visit_item(&mut self, i: &'a ast::Item) {
}
}
ast
::
ItemKind
::
TraitAlias
(
..
)
=>
{
gate_feature_post!
(
&
self
,
trait_alias
,
i
.span
,
"trait aliases are not yet fully implemented"
);
}
ast
::
ItemKind
::
AutoImpl
(
..
)
=>
{
gate_feature_post!
(
&
self
,
optin_builtin_traits
,
i
.span
,
...
...
src/test/compile-fail/trait-alias.rs
浏览文件 @
4f0b4f26
...
...
@@ -8,12 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// gate-test-trait_alias
trait
Alias1
<
T
>
=
Default
where
T
:
Clone
;
// ok
//~^ERROR trait aliases are not yet implemented
//~^ERROR trait aliases are not yet
fully
implemented
trait
Alias2
<
T
:
Clone
=
()
>
=
Default
;
//~^ERROR type parameters on the left side of a trait alias cannot be bounded
//~^^ERROR type parameters on the left side of a trait alias cannot have defaults
//~^^^ERROR trait aliases are not yet implemented
//~^^^ERROR trait aliases are not yet
fully
implemented
impl
Alias1
{
//~ERROR expected type, found trait alias
fn
foo
()
{}
...
...
src/test/ui/trait-alias.rs
浏览文件 @
4f0b4f26
...
...
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(trait_alias)]
trait
SimpleAlias
=
Default
;
//~ERROR E0645
trait
GenericAlias
<
T
>
=
Iterator
<
Item
=
T
>
;
//~ERROR E0645
trait
Partial
<
T
>
=
IntoIterator
<
Item
=
T
>
;
//~ERROR E0645
...
...
src/test/ui/trait-alias.stderr
浏览文件 @
4f0b4f26
error[E0645]: trait aliases are not yet implemented (see issue #41517)
--> $DIR/trait-alias.rs:1
1
:1
--> $DIR/trait-alias.rs:1
3
:1
|
1
1
| trait SimpleAlias = Default; //~ERROR E0645
1
3
| trait SimpleAlias = Default; //~ERROR E0645
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0645]: trait aliases are not yet implemented (see issue #41517)
--> $DIR/trait-alias.rs:1
2
:1
--> $DIR/trait-alias.rs:1
4
:1
|
1
2
| trait GenericAlias<T> = Iterator<Item=T>; //~ERROR E0645
1
4
| trait GenericAlias<T> = Iterator<Item=T>; //~ERROR E0645
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0645]: trait aliases are not yet implemented (see issue #41517)
--> $DIR/trait-alias.rs:1
3
:1
--> $DIR/trait-alias.rs:1
5
:1
|
1
3
| trait Partial<T> = IntoIterator<Item=T>; //~ERROR E0645
1
5
| trait Partial<T> = IntoIterator<Item=T>; //~ERROR E0645
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0645]: trait aliases are not yet implemented (see issue #41517)
--> $DIR/trait-alias.rs:2
2
:1
--> $DIR/trait-alias.rs:2
4
:1
|
2
2
| trait WithWhere<Art, Thou> = Romeo + Romeo where Fore<(Art, Thou)>: Romeo; //~ERROR E0645
2
4
| trait WithWhere<Art, Thou> = Romeo + Romeo where Fore<(Art, Thou)>: Romeo; //~ERROR E0645
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0645]: trait aliases are not yet implemented (see issue #41517)
--> $DIR/trait-alias.rs:2
3
:1
--> $DIR/trait-alias.rs:2
5
:1
|
2
3
| trait BareWhere<Wild, Are> = where The<Wild>: Things<Are>; //~ERROR E0645
2
5
| trait BareWhere<Wild, Are> = where The<Wild>: Things<Are>; //~ERROR E0645
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0645]: trait aliases are not yet implemented (see issue #41517)
--> $DIR/trait-alias.rs:2
5
:1
--> $DIR/trait-alias.rs:2
7
:1
|
2
5
| trait CD = Clone + Default; //~ERROR E0645
2
7
| trait CD = Clone + Default; //~ERROR E0645
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录