提交 4f0b4f26 编写于 作者: A Alex Burka

feature gate trait aliases

上级 4029a019
......@@ -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,
......
......@@ -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() {}
......
......@@ -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
......
error[E0645]: trait aliases are not yet implemented (see issue #41517)
--> $DIR/trait-alias.rs:11:1
--> $DIR/trait-alias.rs:13:1
|
11 | trait SimpleAlias = Default; //~ERROR E0645
13 | trait SimpleAlias = Default; //~ERROR E0645
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0645]: trait aliases are not yet implemented (see issue #41517)
--> $DIR/trait-alias.rs:12:1
--> $DIR/trait-alias.rs:14:1
|
12 | trait GenericAlias<T> = Iterator<Item=T>; //~ERROR E0645
14 | trait GenericAlias<T> = Iterator<Item=T>; //~ERROR E0645
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0645]: trait aliases are not yet implemented (see issue #41517)
--> $DIR/trait-alias.rs:13:1
--> $DIR/trait-alias.rs:15:1
|
13 | trait Partial<T> = IntoIterator<Item=T>; //~ERROR E0645
15 | trait Partial<T> = IntoIterator<Item=T>; //~ERROR E0645
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0645]: trait aliases are not yet implemented (see issue #41517)
--> $DIR/trait-alias.rs:22:1
--> $DIR/trait-alias.rs:24:1
|
22 | trait WithWhere<Art, Thou> = Romeo + Romeo where Fore<(Art, Thou)>: Romeo; //~ERROR E0645
24 | 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:23:1
--> $DIR/trait-alias.rs:25:1
|
23 | trait BareWhere<Wild, Are> = where The<Wild>: Things<Are>; //~ERROR E0645
25 | 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:25:1
--> $DIR/trait-alias.rs:27:1
|
25 | trait CD = Clone + Default; //~ERROR E0645
27 | 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.
先完成此消息的编辑!
想要评论请 注册