rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.14k stars 1.58k forks source link

Enforce Syntax Trees Invariantrs #5006

Open matklad opened 4 years ago

matklad commented 4 years ago

We have couple of weak invariants about our syntax trees, which are not really enforced and sometimes are broken in practice. We should

Here's the tentative list of invariants:

Notably, the following is not an invariant, but we rely on it in some ast extensions:

For example, ast::EnumVariant should return Option

matklad commented 3 years ago

https://github.com/rust-analyzer/rust-analyzer/pull/4680 is something we neeed to look at as well.