Tidy up the code
This commit is contained in:
parent
b0fcb5f440
commit
e09d9ecbcd
1 changed files with 6 additions and 4 deletions
|
|
@ -14,8 +14,9 @@
|
|||
//FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
|
||||
//follow-up PR
|
||||
|
||||
// A Collection trait and collection families.
|
||||
// Based on http://smallcultfollowing.com/babysteps/blog/2016/11/03/associated-type-constructors-part-2-family-traits/
|
||||
// A Collection trait and collection families. Based on
|
||||
// http://smallcultfollowing.com/babysteps/blog/2016/11/03/
|
||||
// associated-type-constructors-part-2-family-traits/
|
||||
|
||||
trait Collection<T> {
|
||||
fn empty() -> Self;
|
||||
|
|
@ -25,7 +26,8 @@ trait Collection<T> {
|
|||
type Iter<'iter>: Iterator<Item=&'iter T>;
|
||||
type Family: CollectionFamily;
|
||||
// Test associated type defaults with parameters
|
||||
type Sibling<U>: Collection<U> = <<Self as Collection<T>>::Family as CollectionFamily>::Member<U>;
|
||||
type Sibling<U>: Collection<U> = <<Self as Collection<T>>::Family as CollectionFamily>::
|
||||
Member<U>;
|
||||
//~^ ERROR type parameters are not allowed on this type [E0109]
|
||||
}
|
||||
|
||||
|
|
@ -82,4 +84,4 @@ fn use_floatify() {
|
|||
println!("{}", c.iterate().next());
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
fn main() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue