Skip to content

Commit 9d0aa17

Browse files
committed
Update generic params based on review.
1 parent 8511cf4 commit 9d0aa17

10 files changed

+26
-33
lines changed

src/items/associated-items.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ let _: f64 = f64::from_i32(42);
8080
### Methods
8181

8282
> _Method_ :\
83-
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup>\
83+
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup>\
8484
> &nbsp;&nbsp; &nbsp;&nbsp; `(` _SelfParam_ (`,` [_FunctionParam_])<sup>\*</sup> `,`<sup>?</sup> `)`\
8585
> &nbsp;&nbsp; &nbsp;&nbsp; [_FunctionReturnType_]<sup>?</sup> [_WhereClause_]<sup>?</sup>\
8686
> &nbsp;&nbsp; &nbsp;&nbsp; [_BlockExpression_]
@@ -344,7 +344,7 @@ fn main() {
344344
[_FunctionParam_]: functions.md
345345
[_FunctionQualifiers_]: functions.md
346346
[_FunctionReturnType_]: functions.md
347-
[_Generics_]: generics.md
347+
[_GenericParams_]: generics.md
348348
[_Lifetime_]: ../trait-bounds.md
349349
[_Type_]: ../types.md#type-expressions
350350
[_WhereClause_]: generics.md#where-clauses

src/items/enumerations.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
> _Enumeration_ :\
55
> &nbsp;&nbsp; `enum`
66
> [IDENTIFIER]&nbsp;
7-
> [_Generics_]<sup>?</sup>
7+
> [_GenericParams_]<sup>?</sup>
88
> [_WhereClause_]<sup>?</sup>
99
> `{` _EnumItems_<sup>?</sup> `}`
1010
>
@@ -172,7 +172,7 @@ enum E {
172172
```
173173

174174
[IDENTIFIER]: ../identifiers.md
175-
[_Generics_]: generics.md
175+
[_GenericParams_]: generics.md
176176
[_WhereClause_]: generics.md#where-clauses
177177
[_Expression_]: ../expressions.md
178178
[_TupleFields_]: structs.md

src/items/external-blocks.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
> &nbsp;&nbsp; `static` `mut`<sup>?</sup> [IDENTIFIER] `:` [_Type_] `;`
1818
>
1919
> _ExternalFunctionItem_ :\
20-
> &nbsp;&nbsp; `fn` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup>\
20+
> &nbsp;&nbsp; `fn` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup>\
2121
> &nbsp;&nbsp; `(` ( _NamedFunctionParameters_ | _NamedFunctionParametersWithVariadics_ )<sup>?</sup> `)`\
2222
> &nbsp;&nbsp; [_FunctionReturnType_]<sup>?</sup> [_WhereClause_]<sup>?</sup> `;`
2323
>
@@ -190,7 +190,7 @@ restrictions as [regular function parameters].
190190
[statics]: static-items.md
191191
[_Abi_]: functions.md
192192
[_FunctionReturnType_]: functions.md
193-
[_Generics_]: generics.md
193+
[_GenericParams_]: generics.md
194194
[_InnerAttribute_]: ../attributes.md
195195
[_MacroInvocationSemi_]: ../macros.md#macro-invocation
196196
[_MetaListNameValueStr_]: ../attributes.md#meta-item-attribute-syntax

src/items/functions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> **<sup>Syntax</sup>**\
44
> _Function_ :\
5-
> &nbsp;&nbsp; _FunctionQualifiers_ `fn` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup>\
5+
> &nbsp;&nbsp; _FunctionQualifiers_ `fn` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup>\
66
> &nbsp;&nbsp; &nbsp;&nbsp; `(` _FunctionParameters_<sup>?</sup> `)`\
77
> &nbsp;&nbsp; &nbsp;&nbsp; _FunctionReturnType_<sup>?</sup> [_WhereClause_]<sup>?</sup>\
88
> &nbsp;&nbsp; &nbsp;&nbsp; [_BlockExpression_]
@@ -341,7 +341,7 @@ fn foo_oof(#[some_inert_attribute] arg: u8) {
341341
[RAW_STRING_LITERAL]: ../tokens.md#raw-string-literals
342342
[STRING_LITERAL]: ../tokens.md#string-literals
343343
[_BlockExpression_]: ../expressions/block-expr.md
344-
[_Generics_]: generics.md
344+
[_GenericParams_]: generics.md
345345
[_Pattern_]: ../patterns.md
346346
[_Type_]: ../types.md#type-expressions
347347
[_WhereClause_]: generics.md#where-clauses

src/items/generics.md

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
# Generic parameters
22

33
> **<sup>Syntax</sup>**\
4-
> _Generics_ :\
5-
> &nbsp;&nbsp; `<` _GenericParams_<sup>?</sup> `>`
6-
>
74
> _GenericParams_ :\
8-
> &nbsp;&nbsp; (_GenericParam_ `,`)<sup>\*</sup> _GenericParam_ `,`<sup>?</sup>
5+
> &nbsp;&nbsp; &nbsp;&nbsp; `<` `>`\
6+
> &nbsp;&nbsp; | `<` (_GenericParam_ `,`)<sup>\*</sup> _GenericParam_ `,`<sup>?</sup> `>`
97
>
108
> _GenericParam_ :\
11-
> &nbsp;&nbsp; [_OuterAttribute_] <sup>\*</sup>\
12-
> &nbsp;&nbsp; (\
13-
> &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; _LifetimeParam_\
14-
> &nbsp;&nbsp; &nbsp;&nbsp; | _TypeParam_\
15-
> &nbsp;&nbsp; &nbsp;&nbsp; | _ConstParam_\
16-
> &nbsp;&nbsp; )
9+
> &nbsp;&nbsp; [_OuterAttribute_]<sup>\*</sup> ( _LifetimeParam_ | _TypeParam_ | _ConstParam_ )
1710
>
1811
> _LifetimeParam_ :\
1912
> &nbsp;&nbsp; [LIFETIME_OR_LABEL]&nbsp;( `:` [_LifetimeBounds_] )<sup>?</sup>
@@ -88,7 +81,7 @@ referred to with path syntax.
8881
> &nbsp;&nbsp; _ForLifetimes_<sup>?</sup> [_Type_] `:` [_TypeParamBounds_]<sup>?</sup>
8982
>
9083
> _ForLifetimes_ :\
91-
> &nbsp;&nbsp; `for` `<` [_GenericParams_](#generic-parameters) `>`
84+
> &nbsp;&nbsp; `for` [_GenericParams_](#generic-parameters)
9285
9386
*Where clauses* provide another way to specify bounds on type and lifetime
9487
parameters as well as a way to specify bounds on types that aren't type

src/items/implementations.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
> &nbsp;&nbsp; _InherentImpl_ | _TraitImpl_
66
>
77
> _InherentImpl_ :\
8-
> &nbsp;&nbsp; `impl` [_Generics_]<sup>?</sup>&nbsp;[_Type_]&nbsp;[_WhereClause_]<sup>?</sup> `{`\
8+
> &nbsp;&nbsp; `impl` [_GenericParams_]<sup>?</sup>&nbsp;[_Type_]&nbsp;[_WhereClause_]<sup>?</sup> `{`\
99
> &nbsp;&nbsp; &nbsp;&nbsp; [_InnerAttribute_]<sup>\*</sup>\
1010
> &nbsp;&nbsp; &nbsp;&nbsp; _InherentImplItem_<sup>\*</sup>\
1111
> &nbsp;&nbsp; `}`
@@ -17,7 +17,7 @@
1717
> &nbsp;&nbsp; )
1818
>
1919
> _TraitImpl_ :\
20-
> &nbsp;&nbsp; `unsafe`<sup>?</sup> `impl` [_Generics_]<sup>?</sup> `!`<sup>?</sup>
20+
> &nbsp;&nbsp; `unsafe`<sup>?</sup> `impl` [_GenericParams_]<sup>?</sup> `!`<sup>?</sup>
2121
> [_TypePath_] `for` [_Type_]\
2222
> &nbsp;&nbsp; [_WhereClause_]<sup>?</sup>\
2323
> &nbsp;&nbsp; `{`\
@@ -206,7 +206,7 @@ attributes].
206206

207207
[_ConstantItem_]: constant-items.md
208208
[_Function_]: functions.md
209-
[_Generics_]: generics.md
209+
[_GenericParams_]: generics.md
210210
[_InnerAttribute_]: ../attributes.md
211211
[_MacroInvocationSemi_]: ../macros.md#macro-invocation
212212
[_Method_]: associated-items.md#methods

src/items/structs.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
> _StructStruct_ :\
99
> &nbsp;&nbsp; `struct`
1010
> [IDENTIFIER]&nbsp;
11-
> [_Generics_]<sup>?</sup>
11+
> [_GenericParams_]<sup>?</sup>
1212
> [_WhereClause_]<sup>?</sup>
1313
> ( `{` _StructFields_<sup>?</sup> `}` | `;` )
1414
>
1515
> _TupleStruct_ :\
1616
> &nbsp;&nbsp; `struct`
1717
> [IDENTIFIER]&nbsp;
18-
> [_Generics_]<sup>?</sup>
18+
> [_GenericParams_]<sup>?</sup>
1919
> `(` _TupleFields_<sup>?</sup> `)`
2020
> [_WhereClause_]<sup>?</sup>
2121
> `;`
@@ -82,7 +82,7 @@ particular layout using the [`repr` attribute].
8282

8383
[_OuterAttribute_]: ../attributes.md
8484
[IDENTIFIER]: ../identifiers.md
85-
[_Generics_]: generics.md
85+
[_GenericParams_]: generics.md
8686
[_WhereClause_]: generics.md#where-clauses
8787
[_Visibility_]: ../visibility-and-privacy.md
8888
[_Type_]: ../types.md#type-expressions

src/items/traits.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> **<sup>Syntax</sup>**\
44
> _Trait_ :\
55
> &nbsp;&nbsp; `unsafe`<sup>?</sup> `trait` [IDENTIFIER]&nbsp;
6-
> [_Generics_]<sup>?</sup>
6+
> [_GenericParams_]<sup>?</sup>
77
> ( `:` [_TypeParamBounds_]<sup>?</sup> )<sup>?</sup>
88
> [_WhereClause_]<sup>?</sup> `{`\
99
> &nbsp;&nbsp;&nbsp;&nbsp; [_InnerAttribute_]<sup>\*</sup>\
@@ -26,12 +26,12 @@
2626
> &nbsp;&nbsp; &nbsp;&nbsp; _TraitMethodDecl_ ( `;` | [_BlockExpression_] )
2727
>
2828
> _TraitFunctionDecl_ :\
29-
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup>\
29+
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup>\
3030
> &nbsp;&nbsp; &nbsp;&nbsp; `(` _TraitFunctionParameters_<sup>?</sup> `)`\
3131
> &nbsp;&nbsp; &nbsp;&nbsp; [_FunctionReturnType_]<sup>?</sup> [_WhereClause_]<sup>?</sup>
3232
>
3333
> _TraitMethodDecl_ :\
34-
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup>\
34+
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup>\
3535
> &nbsp;&nbsp; &nbsp;&nbsp; `(` [_SelfParam_] (`,` _TraitFunctionParam_)<sup>\*</sup> `,`<sup>?</sup> `)`\
3636
> &nbsp;&nbsp; &nbsp;&nbsp; [_FunctionReturnType_]<sup>?</sup> [_WhereClause_]<sup>?</sup>
3737
>
@@ -339,7 +339,7 @@ fn main() {
339339
[_Expression_]: ../expressions.md
340340
[_FunctionQualifiers_]: functions.md
341341
[_FunctionReturnType_]: functions.md
342-
[_Generics_]: generics.md
342+
[_GenericParams_]: generics.md
343343
[_MacroInvocationSemi_]: ../macros.md#macro-invocation
344344
[_OuterAttribute_]: ../attributes.md
345345
[_InnerAttribute_]: ../attributes.md

src/items/type-aliases.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> **<sup>Syntax</sup>**\
44
> _TypeAlias_ :\
5-
> &nbsp;&nbsp; `type` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup>
5+
> &nbsp;&nbsp; `type` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup>
66
> [_WhereClause_]<sup>?</sup> `=` [_Type_] `;`
77
88
A _type alias_ defines a new name for an existing [type]. Type aliases are
@@ -33,6 +33,6 @@ let _ = TypeAlias(5); // Doesn't work
3333
```
3434

3535
[IDENTIFIER]: ../identifiers.md
36-
[_Generics_]: generics.md
36+
[_GenericParams_]: generics.md
3737
[_WhereClause_]: generics.md#where-clauses
3838
[_Type_]: ../types.md#type-expressions

src/items/unions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> **<sup>Syntax</sup>**\
44
> _Union_ :\
5-
> &nbsp;&nbsp; `union` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup> [_WhereClause_]<sup>?</sup>
5+
> &nbsp;&nbsp; `union` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup> [_WhereClause_]<sup>?</sup>
66
> `{`[_StructFields_] `}`
77
88
A union declaration uses the same syntax as a struct declaration, except with
@@ -177,7 +177,7 @@ generics, trait implementations, inherent implementations, coherence, pattern
177177
checking, etc etc etc).
178178

179179
[IDENTIFIER]: ../identifiers.md
180-
[_Generics_]: generics.md
180+
[_GenericParams_]: generics.md
181181
[_WhereClause_]: generics.md#where-clauses
182182
[_StructFields_]: structs.md
183183
[`transmute`]: ../../std/mem/fn.transmute.html

0 commit comments

Comments
 (0)