-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-ArchitectureBig architectural things which we need to figure up-front (or suggestions for rewrites :0) )Big architectural things which we need to figure up-front (or suggestions for rewrites :0) )S-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now
Description
We have couple of weak invariants about our syntax trees, which are not really enforced and sometimes are broken in practice. We should
- document invariants
assert
them- make sure that they are obeyed in practice
Here's the tentative list of invariants:
- The only node that is allowed to be empty is
SourceFile
- The only token kind that is allowed to be empty are fake dollar parens from macro expansion
- Braces should play well with incremental reparsing (see Improve error recovery for unclosed
use
tree lists. #4680 (comment))
Notably, the following is not an invariant, but we rely on it in some ast extensions:
- Parent nodes are not guaranteed to exist.
For example, ast::EnumVariant
should return Option
Metadata
Metadata
Assignees
Labels
C-ArchitectureBig architectural things which we need to figure up-front (or suggestions for rewrites :0) )Big architectural things which we need to figure up-front (or suggestions for rewrites :0) )S-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now