diff --git a/text/0000-trait-alias.md b/text/0000-trait-alias.md index 568354cd7fb..ec9f133b96a 100644 --- a/text/0000-trait-alias.md +++ b/text/0000-trait-alias.md @@ -133,23 +133,27 @@ parameter declarations*. When using a trait alias as an object type, it is subject to object safety restrictions _after_ substituting the aliased traits. This means: -1. It contains an object safe trait and zero or more of these other bounds: `Send`, `Sync`, `'static` (that is, `trait Show = Display + Debug;` would not be object safe). +1. It contains an object safe trait, optionally a lifetime, and zero or more of these other bounds: `Send`, `Sync` (that is, `trait Show = Display + Debug;` would not be object safe). 2. All the associated types of the trait need to be specified. +3. The `where` clause, if present, only contains bounds on `Self`. Some examples: ```rust trait Sink = Sync; -trait PrintableIterator = Display + Iterator; +trait ShareableIterator = Iterator + Sync; +trait PrintableIterator = Iterator + Display; trait IntIterator = Iterator; -fn foo(...) { ... } // ok -fn baz1(x: Box) { ... } // ERROR: associated type not specified -fn baz2(x: Box>) { ... } // ok -fn baz3(x: Box) { ... } // ok (*) +fn foo1(...) { ... } // ok +fn foo2>(...) { ... } // ok +fn bar1(x: Box) { ... } // ERROR: associated type not specified +fn bar2(x: Box>) { ... } // ok +fn bar3(x: Box) { ... } // ERROR: too many traits (*) +fn bar4(x: Box) { ... } // ok (*) ``` -The lines marked with `(*)` require [#24010](https://github.com/rust-lang/rust/issues/24010) to be fixed. +The lines marked with `(*)` assume that [#24010](https://github.com/rust-lang/rust/issues/24010) is fixed. # Drawbacks [drawbacks]: #drawbacks