Skip to content

Commit 362c0ee

Browse files
committed
Add some footnotes to the grammar of trait object types
1 parent d661270 commit 362c0ee

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/types/trait-object.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ r[type.trait-object]
33

44
r[type.trait-object.syntax]
55
```grammar,types
6-
TraitObjectType -> Bounds | `dyn` Bounds?
6+
TraitObjectType -> Bounds[^bare-2021] | `dyn`[^dyn-2018] Bounds?
77
8-
TraitObjectTypeOneBound -> TraitBound | `dyn` TraitBound?
8+
TraitObjectTypeOneBound -> TraitBound[^bare-2021] | `dyn`[^dyn-2018] TraitBound?
99
```
1010

11+
[^bare-2021]: See [type.trait-object.syntax-edition2021].
12+
[^dyn-2018]: See [type.trait-object.syntax-edition2018].
13+
1114
r[type.trait-object.intro]
1215
A *trait object* is an opaque value of another type that implements a set of traits. The set of traits is made up of a [dyn compatible] *base trait* plus any number of [auto traits].
1316

@@ -30,7 +33,7 @@ For example, given a trait `Trait`, the following are all trait objects:
3033

3134
r[type.trait-object.syntax-edition2021]
3235
> [!EDITION-2021]
33-
> Before the 2021 edition, the `dyn` keyword may be omitted.
36+
> Before the 2021 edition, the `dyn` keyword may be omitted. In the 2021 edition and beyond, the `dyn` keyword is required semantically.
3437
3538
r[type.trait-object.syntax-edition2018]
3639
> [!EDITION-2018]

0 commit comments

Comments
 (0)