`Generics` does not tokenize its `WhereClause`
- Dominant language
- Rust
- Stars
- 3.4k
- Forks
- 374
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 2
Description
The `ToTokens` impl for `Generics` does not tokenize the contained `WhereClause` - instead, any items which contain a `Generics` (e.g. `ItemStruct`) explicitly tokenize the `WhereClause` in the correct position.
This is a major footgun - if a `Generics` is extracted from a parsed item and then `quote!`ed somewhere else, the `WhereClause` will silently be lost. This can lead to confusing errors, since the lack of a where clause can cause type-checking to fail.
Making `Generics` include its `WhereClause` during tokenization would be a breaking change (and there may be drawbacks that I haven't thought of). However, the documentation should clearly state that tokenizing a `Generics` is lossy, to help prevent confusing errors in downstream crates.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.