Skip to content

Commit

Permalink
Update lifetimes for pre-expansion validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Nov 4, 2024
1 parent da0f6da commit 56405a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/items/generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ r[items.generics.syntax]
> &nbsp;&nbsp; [_OuterAttribute_]<sup>\*</sup> ( _LifetimeParam_ | _TypeParam_ | _ConstParam_ )
>
> _LifetimeParam_ :\
> &nbsp;&nbsp; [LIFETIME_OR_LABEL]&nbsp;( `:` [_LifetimeBounds_] )<sup>?</sup>
> &nbsp;&nbsp; [_Lifetime_]&nbsp;( `:` [_LifetimeBounds_] )<sup>?</sup>
>
> _TypeParam_ :\
> &nbsp;&nbsp; [IDENTIFIER]&nbsp;( `:` [_TypeParamBounds_]<sup>?</sup> )<sup>?</sup> ( `=` [_Type_] )<sup>?</sup>
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,6 @@ r[lex.token.life.syntax]
>
> LIFETIME_OR_LABEL :\
> &nbsp;&nbsp; &nbsp;&nbsp; `'` [NON_KEYWORD_IDENTIFIER][identifier]
> _(not immediately followed by `'`)_\
> &nbsp;&nbsp; | `'_`
> _(not immediately followed by `'`)_
r[lex.token.life.intro]
Expand Down
3 changes: 2 additions & 1 deletion src/trait-bounds.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ r[bound.syntax]
>
> _Lifetime_ :\
> &nbsp;&nbsp; &nbsp;&nbsp; [LIFETIME_OR_LABEL]\
> &nbsp;&nbsp; | `'static`
> &nbsp;&nbsp; | `'static`\
> &nbsp;&nbsp; | `'_`
>
> _UseBound_ :\
> &nbsp;&nbsp; `use` _UseBoundGenericArgs_
Expand Down

0 comments on commit 56405a3

Please sign in to comment.