@@ -500,7 +500,7 @@ Because captures are often by reference, the following general rules arise:
500
500
501
501
> ** <sup >Syntax</sup >**
502
502
> _ TraitObjectType_ :
503
- >   ;  ; [ _ LifetimeOrPath_ ] ( ` + ` [ _ LifetimeOrPath_ ] )<sup >\* </sup > ` + ` <sup >?</sup >
503
+ >   ;  ; _ LifetimeOrPath_ ( ` + ` _ LifetimeOrPath_ )<sup >\* </sup > ` + ` <sup >?</sup >
504
504
>
505
505
> _ LifetimeOrPath_ :
506
506
>   ;  ; [ _ Path_ ] | [ _ LIFETIME_OR_LABEL_ ]
@@ -512,11 +512,12 @@ number of [auto traits].
512
512
Trait objects implement the base trait, its auto traits, and any super traits
513
513
of the base trait.
514
514
515
- Trait objects are written the same as trait bounds with the exception that all
516
- traits except the first trait must be auto traits and there may not be more than
517
- one lifetime. For example, given a trait ` Trait ` , the following
518
- are all trait objects: ` Trait ` , ` Trait + Send ` , ` Trait + Send + Sync ` ,
519
- ` Trait + 'static ` , ` Trait + Send + 'static ` , ` Trait + ` , ` 'static + Trait ` .
515
+ Trait objects are written the same as trait bounds, but with the following
516
+ restrictions. All traits except the first trait must be auto traits, there may
517
+ not be more than one lifetime, and opt-out bounds (e.g. ` ?sized ` ) are not
518
+ allowed. For example, given a trait ` Trait ` , the following are all trait
519
+ objects: ` Trait ` , ` Trait + Send ` , ` Trait + Send + Sync ` , ` Trait + 'static ` ,
520
+ ` Trait + Send + 'static ` , ` Trait + ` , ` 'static + Trait ` .
520
521
521
522
Two trait object types alias each other if the base traits alias each other and
522
523
if the sets of auto traits are the same and the lifetime bounds are the same.
0 commit comments