From ac059987901260c345d3866c99946884facb7f16 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 9 Jan 2021 07:45:46 -0800 Subject: [PATCH] Update generic params based on review. --- src/items/associated-items.md | 4 ++-- src/items/enumerations.md | 4 ++-- src/items/external-blocks.md | 4 ++-- src/items/functions.md | 4 ++-- src/items/generics.md | 15 ++++----------- src/items/implementations.md | 6 +++--- src/items/structs.md | 6 +++--- src/items/traits.md | 8 ++++---- src/items/type-aliases.md | 4 ++-- src/items/unions.md | 4 ++-- 10 files changed, 26 insertions(+), 33 deletions(-) diff --git a/src/items/associated-items.md b/src/items/associated-items.md index 5434c0495..c1ad2397e 100644 --- a/src/items/associated-items.md +++ b/src/items/associated-items.md @@ -80,7 +80,7 @@ let _: f64 = f64::from_i32(42); ### Methods > _Method_ :\ ->    [_FunctionQualifiers_] `fn` [IDENTIFIER] [_Generics_]?\ +>    [_FunctionQualifiers_] `fn` [IDENTIFIER] [_GenericParams_]?\ >       `(` _SelfParam_ (`,` [_FunctionParam_])\* `,`? `)`\ >       [_FunctionReturnType_]? [_WhereClause_]?\ >       [_BlockExpression_] @@ -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 diff --git a/src/items/enumerations.md b/src/items/enumerations.md index 7e4795508..8248a47db 100644 --- a/src/items/enumerations.md +++ b/src/items/enumerations.md @@ -4,7 +4,7 @@ > _Enumeration_ :\ >    `enum` > [IDENTIFIER]  -> [_Generics_]? +> [_GenericParams_]? > [_WhereClause_]? > `{` _EnumItems_? `}` > @@ -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 diff --git a/src/items/external-blocks.md b/src/items/external-blocks.md index b31dd17d4..6a1ada912 100644 --- a/src/items/external-blocks.md +++ b/src/items/external-blocks.md @@ -17,7 +17,7 @@ >    `static` `mut`? [IDENTIFIER] `:` [_Type_] `;` > > _ExternalFunctionItem_ :\ ->    `fn` [IDENTIFIER] [_Generics_]?\ +>    `fn` [IDENTIFIER] [_GenericParams_]?\ >    `(` ( _NamedFunctionParameters_ | _NamedFunctionParametersWithVariadics_ )? `)`\ >    [_FunctionReturnType_]? [_WhereClause_]? `;` > @@ -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 diff --git a/src/items/functions.md b/src/items/functions.md index 27dbef24b..550f6d96a 100644 --- a/src/items/functions.md +++ b/src/items/functions.md @@ -2,7 +2,7 @@ > **Syntax**\ > _Function_ :\ ->    _FunctionQualifiers_ `fn` [IDENTIFIER] [_Generics_]?\ +>    _FunctionQualifiers_ `fn` [IDENTIFIER] [_GenericParams_]?\ >       `(` _FunctionParameters_? `)`\ >       _FunctionReturnType_? [_WhereClause_]?\ >       [_BlockExpression_] @@ -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 diff --git a/src/items/generics.md b/src/items/generics.md index a798d91f7..789563c8a 100644 --- a/src/items/generics.md +++ b/src/items/generics.md @@ -1,19 +1,12 @@ # Generic parameters > **Syntax**\ -> _Generics_ :\ ->    `<` _GenericParams_? `>` -> > _GenericParams_ :\ ->    (_GenericParam_ `,`)\* _GenericParam_ `,`? +>       `<` `>`\ +>    | `<` (_GenericParam_ `,`)\* _GenericParam_ `,`? `>` > > _GenericParam_ :\ ->    [_OuterAttribute_] \*\ ->    (\ ->          _LifetimeParam_\ ->       | _TypeParam_\ ->       | _ConstParam_\ ->    ) +>    [_OuterAttribute_]\* ( _LifetimeParam_ | _TypeParam_ | _ConstParam_ ) > > _LifetimeParam_ :\ >    [LIFETIME_OR_LABEL] ( `:` [_LifetimeBounds_] )? @@ -88,7 +81,7 @@ referred to with path syntax. >    _ForLifetimes_? [_Type_] `:` [_TypeParamBounds_]? > > _ForLifetimes_ :\ ->    `for` `<` [_GenericParams_](#generic-parameters) `>` +>    `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 diff --git a/src/items/implementations.md b/src/items/implementations.md index 26ba45a8e..976241481 100644 --- a/src/items/implementations.md +++ b/src/items/implementations.md @@ -5,7 +5,7 @@ >    _InherentImpl_ | _TraitImpl_ > > _InherentImpl_ :\ ->    `impl` [_Generics_]? [_Type_] [_WhereClause_]? `{`\ +>    `impl` [_GenericParams_]? [_Type_] [_WhereClause_]? `{`\ >       [_InnerAttribute_]\*\ >       _InherentImplItem_\*\ >    `}` @@ -17,7 +17,7 @@ >    ) > > _TraitImpl_ :\ ->    `unsafe`? `impl` [_Generics_]? `!`? +>    `unsafe`? `impl` [_GenericParams_]? `!`? > [_TypePath_] `for` [_Type_]\ >    [_WhereClause_]?\ >    `{`\ @@ -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 diff --git a/src/items/structs.md b/src/items/structs.md index debd52cc7..9523e7bfb 100644 --- a/src/items/structs.md +++ b/src/items/structs.md @@ -8,14 +8,14 @@ > _StructStruct_ :\ >    `struct` > [IDENTIFIER]  -> [_Generics_]? +> [_GenericParams_]? > [_WhereClause_]? > ( `{` _StructFields_? `}` | `;` ) > > _TupleStruct_ :\ >    `struct` > [IDENTIFIER]  -> [_Generics_]? +> [_GenericParams_]? > `(` _TupleFields_? `)` > [_WhereClause_]? > `;` @@ -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 diff --git a/src/items/traits.md b/src/items/traits.md index d08f45c6f..3094bb49f 100644 --- a/src/items/traits.md +++ b/src/items/traits.md @@ -3,7 +3,7 @@ > **Syntax**\ > _Trait_ :\ >    `unsafe`? `trait` [IDENTIFIER]  -> [_Generics_]? +> [_GenericParams_]? > ( `:` [_TypeParamBounds_]? )? > [_WhereClause_]? `{`\ >      [_InnerAttribute_]\*\ @@ -26,12 +26,12 @@ >       _TraitMethodDecl_ ( `;` | [_BlockExpression_] ) > > _TraitFunctionDecl_ :\ ->    [_FunctionQualifiers_] `fn` [IDENTIFIER] [_Generics_]?\ +>    [_FunctionQualifiers_] `fn` [IDENTIFIER] [_GenericParams_]?\ >       `(` _TraitFunctionParameters_? `)`\ >       [_FunctionReturnType_]? [_WhereClause_]? > > _TraitMethodDecl_ :\ ->    [_FunctionQualifiers_] `fn` [IDENTIFIER] [_Generics_]?\ +>    [_FunctionQualifiers_] `fn` [IDENTIFIER] [_GenericParams_]?\ >       `(` [_SelfParam_] (`,` _TraitFunctionParam_)\* `,`? `)`\ >       [_FunctionReturnType_]? [_WhereClause_]? > @@ -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 diff --git a/src/items/type-aliases.md b/src/items/type-aliases.md index 6afd7a7fa..d8fc5bf66 100644 --- a/src/items/type-aliases.md +++ b/src/items/type-aliases.md @@ -2,7 +2,7 @@ > **Syntax**\ > _TypeAlias_ :\ ->    `type` [IDENTIFIER] [_Generics_]? +>    `type` [IDENTIFIER] [_GenericParams_]? > [_WhereClause_]? `=` [_Type_] `;` A _type alias_ defines a new name for an existing [type]. Type aliases are @@ -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 diff --git a/src/items/unions.md b/src/items/unions.md index c974a9a55..dabb6355c 100644 --- a/src/items/unions.md +++ b/src/items/unions.md @@ -2,7 +2,7 @@ > **Syntax**\ > _Union_ :\ ->    `union` [IDENTIFIER] [_Generics_]? [_WhereClause_]? +>    `union` [IDENTIFIER] [_GenericParams_]? [_WhereClause_]? > `{`[_StructFields_] `}` A union declaration uses the same syntax as a struct declaration, except with @@ -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