Skip to content

Commit

Permalink
Update generic params based on review.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Jan 10, 2021
1 parent 8511cf4 commit 9d0aa17
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/items/associated-items.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ let _: f64 = f64::from_i32(42);
### Methods

> _Method_ :\
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup>\
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup>\
> &nbsp;&nbsp; &nbsp;&nbsp; `(` _SelfParam_ (`,` [_FunctionParam_])<sup>\*</sup> `,`<sup>?</sup> `)`\
> &nbsp;&nbsp; &nbsp;&nbsp; [_FunctionReturnType_]<sup>?</sup> [_WhereClause_]<sup>?</sup>\
> &nbsp;&nbsp; &nbsp;&nbsp; [_BlockExpression_]
Expand Down Expand Up @@ -344,7 +344,7 @@ fn main() {
[_FunctionParam_]: functions.md
[_FunctionQualifiers_]: functions.md
[_FunctionReturnType_]: functions.md
[_Generics_]: generics.md
[_GenericParams_]: generics.md
[_Lifetime_]: ../trait-bounds.md
[_Type_]: ../types.md#type-expressions
[_WhereClause_]: generics.md#where-clauses
Expand Down
4 changes: 2 additions & 2 deletions src/items/enumerations.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
> _Enumeration_ :\
> &nbsp;&nbsp; `enum`
> [IDENTIFIER]&nbsp;
> [_Generics_]<sup>?</sup>
> [_GenericParams_]<sup>?</sup>
> [_WhereClause_]<sup>?</sup>
> `{` _EnumItems_<sup>?</sup> `}`
>
Expand Down Expand Up @@ -172,7 +172,7 @@ enum E {
```

[IDENTIFIER]: ../identifiers.md
[_Generics_]: generics.md
[_GenericParams_]: generics.md
[_WhereClause_]: generics.md#where-clauses
[_Expression_]: ../expressions.md
[_TupleFields_]: structs.md
Expand Down
4 changes: 2 additions & 2 deletions src/items/external-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
> &nbsp;&nbsp; `static` `mut`<sup>?</sup> [IDENTIFIER] `:` [_Type_] `;`
>
> _ExternalFunctionItem_ :\
> &nbsp;&nbsp; `fn` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup>\
> &nbsp;&nbsp; `fn` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup>\
> &nbsp;&nbsp; `(` ( _NamedFunctionParameters_ | _NamedFunctionParametersWithVariadics_ )<sup>?</sup> `)`\
> &nbsp;&nbsp; [_FunctionReturnType_]<sup>?</sup> [_WhereClause_]<sup>?</sup> `;`
>
Expand Down Expand Up @@ -190,7 +190,7 @@ restrictions as [regular function parameters].
[statics]: static-items.md
[_Abi_]: functions.md
[_FunctionReturnType_]: functions.md
[_Generics_]: generics.md
[_GenericParams_]: generics.md
[_InnerAttribute_]: ../attributes.md
[_MacroInvocationSemi_]: ../macros.md#macro-invocation
[_MetaListNameValueStr_]: ../attributes.md#meta-item-attribute-syntax
Expand Down
4 changes: 2 additions & 2 deletions src/items/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> **<sup>Syntax</sup>**\
> _Function_ :\
> &nbsp;&nbsp; _FunctionQualifiers_ `fn` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup>\
> &nbsp;&nbsp; _FunctionQualifiers_ `fn` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup>\
> &nbsp;&nbsp; &nbsp;&nbsp; `(` _FunctionParameters_<sup>?</sup> `)`\
> &nbsp;&nbsp; &nbsp;&nbsp; _FunctionReturnType_<sup>?</sup> [_WhereClause_]<sup>?</sup>\
> &nbsp;&nbsp; &nbsp;&nbsp; [_BlockExpression_]
Expand Down Expand Up @@ -341,7 +341,7 @@ fn foo_oof(#[some_inert_attribute] arg: u8) {
[RAW_STRING_LITERAL]: ../tokens.md#raw-string-literals
[STRING_LITERAL]: ../tokens.md#string-literals
[_BlockExpression_]: ../expressions/block-expr.md
[_Generics_]: generics.md
[_GenericParams_]: generics.md
[_Pattern_]: ../patterns.md
[_Type_]: ../types.md#type-expressions
[_WhereClause_]: generics.md#where-clauses
Expand Down
15 changes: 4 additions & 11 deletions src/items/generics.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
# Generic parameters

> **<sup>Syntax</sup>**\
> _Generics_ :\
> &nbsp;&nbsp; `<` _GenericParams_<sup>?</sup> `>`
>
> _GenericParams_ :\
> &nbsp;&nbsp; (_GenericParam_ `,`)<sup>\*</sup> _GenericParam_ `,`<sup>?</sup>
> &nbsp;&nbsp; &nbsp;&nbsp; `<` `>`\
> &nbsp;&nbsp; | `<` (_GenericParam_ `,`)<sup>\*</sup> _GenericParam_ `,`<sup>?</sup> `>`
>
> _GenericParam_ :\
> &nbsp;&nbsp; [_OuterAttribute_] <sup>\*</sup>\
> &nbsp;&nbsp; (\
> &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; _LifetimeParam_\
> &nbsp;&nbsp; &nbsp;&nbsp; | _TypeParam_\
> &nbsp;&nbsp; &nbsp;&nbsp; | _ConstParam_\
> &nbsp;&nbsp; )
> &nbsp;&nbsp; [_OuterAttribute_]<sup>\*</sup> ( _LifetimeParam_ | _TypeParam_ | _ConstParam_ )
>
> _LifetimeParam_ :\
> &nbsp;&nbsp; [LIFETIME_OR_LABEL]&nbsp;( `:` [_LifetimeBounds_] )<sup>?</sup>
Expand Down Expand Up @@ -88,7 +81,7 @@ referred to with path syntax.
> &nbsp;&nbsp; _ForLifetimes_<sup>?</sup> [_Type_] `:` [_TypeParamBounds_]<sup>?</sup>
>
> _ForLifetimes_ :\
> &nbsp;&nbsp; `for` `<` [_GenericParams_](#generic-parameters) `>`
> &nbsp;&nbsp; `for` [_GenericParams_](#generic-parameters)
*Where clauses* provide another way to specify bounds on type and lifetime
parameters as well as a way to specify bounds on types that aren't type
Expand Down
6 changes: 3 additions & 3 deletions src/items/implementations.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
> &nbsp;&nbsp; _InherentImpl_ | _TraitImpl_
>
> _InherentImpl_ :\
> &nbsp;&nbsp; `impl` [_Generics_]<sup>?</sup>&nbsp;[_Type_]&nbsp;[_WhereClause_]<sup>?</sup> `{`\
> &nbsp;&nbsp; `impl` [_GenericParams_]<sup>?</sup>&nbsp;[_Type_]&nbsp;[_WhereClause_]<sup>?</sup> `{`\
> &nbsp;&nbsp; &nbsp;&nbsp; [_InnerAttribute_]<sup>\*</sup>\
> &nbsp;&nbsp; &nbsp;&nbsp; _InherentImplItem_<sup>\*</sup>\
> &nbsp;&nbsp; `}`
Expand All @@ -17,7 +17,7 @@
> &nbsp;&nbsp; )
>
> _TraitImpl_ :\
> &nbsp;&nbsp; `unsafe`<sup>?</sup> `impl` [_Generics_]<sup>?</sup> `!`<sup>?</sup>
> &nbsp;&nbsp; `unsafe`<sup>?</sup> `impl` [_GenericParams_]<sup>?</sup> `!`<sup>?</sup>
> [_TypePath_] `for` [_Type_]\
> &nbsp;&nbsp; [_WhereClause_]<sup>?</sup>\
> &nbsp;&nbsp; `{`\
Expand Down Expand Up @@ -206,7 +206,7 @@ attributes].

[_ConstantItem_]: constant-items.md
[_Function_]: functions.md
[_Generics_]: generics.md
[_GenericParams_]: generics.md
[_InnerAttribute_]: ../attributes.md
[_MacroInvocationSemi_]: ../macros.md#macro-invocation
[_Method_]: associated-items.md#methods
Expand Down
6 changes: 3 additions & 3 deletions src/items/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
> _StructStruct_ :\
> &nbsp;&nbsp; `struct`
> [IDENTIFIER]&nbsp;
> [_Generics_]<sup>?</sup>
> [_GenericParams_]<sup>?</sup>
> [_WhereClause_]<sup>?</sup>
> ( `{` _StructFields_<sup>?</sup> `}` | `;` )
>
> _TupleStruct_ :\
> &nbsp;&nbsp; `struct`
> [IDENTIFIER]&nbsp;
> [_Generics_]<sup>?</sup>
> [_GenericParams_]<sup>?</sup>
> `(` _TupleFields_<sup>?</sup> `)`
> [_WhereClause_]<sup>?</sup>
> `;`
Expand Down Expand Up @@ -82,7 +82,7 @@ particular layout using the [`repr` attribute].

[_OuterAttribute_]: ../attributes.md
[IDENTIFIER]: ../identifiers.md
[_Generics_]: generics.md
[_GenericParams_]: generics.md
[_WhereClause_]: generics.md#where-clauses
[_Visibility_]: ../visibility-and-privacy.md
[_Type_]: ../types.md#type-expressions
8 changes: 4 additions & 4 deletions src/items/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
> **<sup>Syntax</sup>**\
> _Trait_ :\
> &nbsp;&nbsp; `unsafe`<sup>?</sup> `trait` [IDENTIFIER]&nbsp;
> [_Generics_]<sup>?</sup>
> [_GenericParams_]<sup>?</sup>
> ( `:` [_TypeParamBounds_]<sup>?</sup> )<sup>?</sup>
> [_WhereClause_]<sup>?</sup> `{`\
> &nbsp;&nbsp;&nbsp;&nbsp; [_InnerAttribute_]<sup>\*</sup>\
Expand All @@ -26,12 +26,12 @@
> &nbsp;&nbsp; &nbsp;&nbsp; _TraitMethodDecl_ ( `;` | [_BlockExpression_] )
>
> _TraitFunctionDecl_ :\
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup>\
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup>\
> &nbsp;&nbsp; &nbsp;&nbsp; `(` _TraitFunctionParameters_<sup>?</sup> `)`\
> &nbsp;&nbsp; &nbsp;&nbsp; [_FunctionReturnType_]<sup>?</sup> [_WhereClause_]<sup>?</sup>
>
> _TraitMethodDecl_ :\
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_Generics_]<sup>?</sup>\
> &nbsp;&nbsp; [_FunctionQualifiers_] `fn` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup>\
> &nbsp;&nbsp; &nbsp;&nbsp; `(` [_SelfParam_] (`,` _TraitFunctionParam_)<sup>\*</sup> `,`<sup>?</sup> `)`\
> &nbsp;&nbsp; &nbsp;&nbsp; [_FunctionReturnType_]<sup>?</sup> [_WhereClause_]<sup>?</sup>
>
Expand Down Expand Up @@ -339,7 +339,7 @@ fn main() {
[_Expression_]: ../expressions.md
[_FunctionQualifiers_]: functions.md
[_FunctionReturnType_]: functions.md
[_Generics_]: generics.md
[_GenericParams_]: generics.md
[_MacroInvocationSemi_]: ../macros.md#macro-invocation
[_OuterAttribute_]: ../attributes.md
[_InnerAttribute_]: ../attributes.md
Expand Down
4 changes: 2 additions & 2 deletions src/items/type-aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

[IDENTIFIER]: ../identifiers.md
[_Generics_]: generics.md
[_GenericParams_]: generics.md
[_WhereClause_]: generics.md#where-clauses
[_Type_]: ../types.md#type-expressions
4 changes: 2 additions & 2 deletions src/items/unions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

[IDENTIFIER]: ../identifiers.md
[_Generics_]: generics.md
[_GenericParams_]: generics.md
[_WhereClause_]: generics.md#where-clauses
[_StructFields_]: structs.md
[`transmute`]: ../../std/mem/fn.transmute.html
Expand Down

0 comments on commit 9d0aa17

Please sign in to comment.