From 56405a3b876cedf684442fa0a63947126b5d79c9 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 30 Oct 2024 07:45:29 -0700 Subject: [PATCH] Update lifetimes for pre-expansion validation --- src/items/generics.md | 7 +++---- src/tokens.md | 2 -- src/trait-bounds.md | 3 ++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/items/generics.md b/src/items/generics.md index feb84ee69..5fab8de8e 100644 --- a/src/items/generics.md +++ b/src/items/generics.md @@ -12,7 +12,7 @@ r[items.generics.syntax] >    [_OuterAttribute_]\* ( _LifetimeParam_ | _TypeParam_ | _ConstParam_ ) > > _LifetimeParam_ :\ ->    [LIFETIME_OR_LABEL] ( `:` [_LifetimeBounds_] )? +>    [_Lifetime_] ( `:` [_LifetimeBounds_] )? > > _TypeParam_ :\ >    [IDENTIFIER] ( `:` [_TypeParamBounds_]? )? ( `=` [_Type_] )? @@ -54,8 +54,8 @@ r[items.generics.builtin-generic-types] [function pointers] have lifetime or type parameters as well, but are not referred to with path syntax. -r[items.generics.wildcard-lifetime] -`'_` is not a valid lifetime parameter. +r[items.generics.invalid-lifetimes] +`'_` and `'_static` are not valid lifetime parameters. ### Const generics @@ -294,7 +294,6 @@ struct Foo<#[my_flexible_clone(unbounded)] H> { ``` [IDENTIFIER]: ../identifiers.md -[LIFETIME_OR_LABEL]: ../tokens.md#lifetimes-and-loop-labels [_ForLifetimes_]: ../trait-bounds.md#higher-ranked-trait-bounds [_LifetimeParam_]: #generic-parameters diff --git a/src/tokens.md b/src/tokens.md index 774a73b9f..fe2b5534f 100644 --- a/src/tokens.md +++ b/src/tokens.md @@ -762,8 +762,6 @@ r[lex.token.life.syntax] > > LIFETIME_OR_LABEL :\ >       `'` [NON_KEYWORD_IDENTIFIER][identifier] -> _(not immediately followed by `'`)_\ ->    | `'_` > _(not immediately followed by `'`)_ r[lex.token.life.intro] diff --git a/src/trait-bounds.md b/src/trait-bounds.md index 4a7636a53..2ff83412c 100644 --- a/src/trait-bounds.md +++ b/src/trait-bounds.md @@ -21,7 +21,8 @@ r[bound.syntax] > > _Lifetime_ :\ >       [LIFETIME_OR_LABEL]\ ->    | `'static` +>    | `'static`\ +>    | `'_` > > _UseBound_ :\ >    `use` _UseBoundGenericArgs_