mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
feature gate trait aliases
This commit is contained in:
parent
4029a01984
commit
4f0b4f267f
@ -368,6 +368,8 @@ declare_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 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -1,37 +1,37 @@
|
||||
error[E0645]: trait aliases are not yet implemented (see issue #41517)
|
||||
--> $DIR/trait-alias.rs:11:1
|
||||
|
|
||||
11 | trait SimpleAlias = Default; //~ERROR E0645
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0645]: trait aliases are not yet implemented (see issue #41517)
|
||||
--> $DIR/trait-alias.rs:12:1
|
||||
|
|
||||
12 | 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
|
||||
|
|
||||
13 | trait Partial<T> = IntoIterator<Item=T>; //~ERROR E0645
|
||||
13 | trait SimpleAlias = Default; //~ERROR E0645
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0645]: trait aliases are not yet implemented (see issue #41517)
|
||||
--> $DIR/trait-alias.rs:14:1
|
||||
|
|
||||
14 | trait GenericAlias<T> = Iterator<Item=T>; //~ERROR E0645
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0645]: trait aliases are not yet implemented (see issue #41517)
|
||||
--> $DIR/trait-alias.rs:15:1
|
||||
|
|
||||
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
|
||||
|
|
||||
23 | 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
|
||||
|
|
||||
25 | trait CD = Clone + Default; //~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:27:1
|
||||
|
|
||||
27 | trait CD = Clone + Default; //~ERROR E0645
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
Loading…
Reference in New Issue
Block a user