Extended elaboration for trait aliases to include arbitrary bounds.
This commit is contained in:
parent
a8fcfcef30
commit
4bdc3d833a
11 changed files with 57 additions and 59 deletions
|
|
@ -8,13 +8,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// gate-test-trait_alias
|
||||
#![feature(trait_alias)]
|
||||
|
||||
trait CloneDefault<T> = Default where T: Clone;
|
||||
trait BoundedAlias<T: Clone = ()> = Default;
|
||||
|
||||
trait A<T: Send> {}
|
||||
trait B<T> = A<T>; // FIXME: parameter T should need a bound here, or semantics should be changed
|
||||
trait Foo {}
|
||||
trait A<T: Foo> {}
|
||||
trait B<T> = A<T>; // T cannot be unbounded
|
||||
|
||||
impl CloneDefault for () {}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ LL | trait BoundedAlias<T: Clone = ()> = Default;
|
|||
error[E0658]: trait aliases are experimental (see issue #41517)
|
||||
--> $DIR/trait-alias-fail1.rs:17:1
|
||||
|
|
||||
LL | trait B<T> = A<T>; // FIXME: this should not work... or should it?
|
||||
LL | trait B<T> = A<T>; // FIXME: parameter T should need a bound here, or semantics should be changed
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(trait_alias)] to the crate attributes to enable
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// gate-test-trait_alias
|
||||
#![feature(trait_alias)]
|
||||
|
||||
trait EqAlias = Eq;
|
||||
trait IteratorAlias = Iterator;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue