Skip to content

Commit 3c8acda

Browse files
committed
Review comments
1 parent 37881f5 commit 3c8acda

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/items/associated-items.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ lifetime or const parameters, `Bounds` is a plus-separated list of trait bounds
211211
on the associated type, and `WhereBounds` is a comma-separated list of bounds on
212212
parameters:
213213

214+
<!-- ignore: illustrative example forms -->
214215
```rust,ignore
215216
type Assoc;
216217
type Assoc: Bounds;
@@ -228,11 +229,12 @@ An *associated type definition* defines a type alias for the implementation
228229
of a trait on a type. They are written similarly to an *associated type declaration*,
229230
but cannot contain `Bounds`, but instead must contain a `Type`:
230231

232+
<!-- ignore: illustrative example forms -->
231233
```rust,ignore
232234
type Assoc = Type;
233235
type Assoc<Params> = Type; // the type `Type` here may reference `Params`
234-
type Assoc<Params> where WhereBounds = Type;
235236
type Assoc<Params> = Type where WhereBounds;
237+
type Assoc<Params> where WhereBounds = Type; // deprecated, prefer the form above
236238
```
237239

238240
If a type `Item` has an associated type `Assoc` from a trait `Trait`, then

src/items/type-aliases.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ let _ = UseAlias(5); // OK
3131
let _ = TypeAlias(5); // Doesn't work
3232
```
3333

34-
A type alias without the [_Type_] specification may only appear as an
35-
[associated type] in a [trait].
34+
A type alias, when not used as an associated type, must include a [_Type_] and
35+
may not include [_TypeParamBounds_].
3636

37-
A type alias with the [_Type_] specification may only appear as an
38-
[associated type] in a [trait impl].
37+
A type alias, when used as an [associated type] in a [trait], must not include a
38+
[_Type_] specification but may include [_TypeParamBounds_].
3939

40-
A type alias with [_TypeParamBounds_] may only specified when used as
41-
an [associated type] in a [trait].
40+
A type alias, when used as an [associated type] in a [trait impl], must include
41+
a [_Type_] specification and may not include [_TypeParamBounds_].
4242

4343
Where clauses before the equals sign on a type alias in a [trait impl] (like
4444
`type TypeAlias<T> where T: Foo = Bar<T>`) are deprecated. Where clauses after

0 commit comments

Comments
 (0)