Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/items/generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ LifetimeParam -> Lifetime ( `:` LifetimeBounds )?

TypeParam -> IDENTIFIER ( `:` Bounds? )? ( `=` Type )?

ConstParam ->
`const` IDENTIFIER `:` Type
( `=` ( BlockExpression | IDENTIFIER | `-`?LiteralExpression ) )?
ConstParam -> `const` IDENTIFIER `:` Type ( `=` ConstArg )?
```

r[items.generics.syntax.intro]
Expand Down
7 changes: 3 additions & 4 deletions src/paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ TypeList ->
( Type `,` )* Type `,`?

GenericArg ->
Lifetime | Type | GenericArgsConst | GenericArgsBinding | GenericArgsBounds
Lifetime | Type | ConstArg | GenericArgsBinding | GenericArgsBounds

GenericArgsConst ->
ConstArg ->
Copy link
Copy Markdown
Member Author

@fmease fmease May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const arg / constant argument is the term we use in rustc (internally and in diagnostics).

Moreover, in rustc's parser, const arg doesn't just refer to const arguments literally but also to const param defaults (and to the RHS of associated const bindings as in TraitRef<CT = { 1 + 1 }> but that's unstable syntax). So "reusing" ConstArg in rule ConstParam doesn't come out of thin air.

View changes since the review

BlockExpression
| LiteralExpression
| `-` LiteralExpression
| `-`? LiteralExpression
| SimplePathSegment

GenericArgsBinding ->
Expand Down
Loading