]> git.lizzy.rs Git - rust.git/commit
internal: fix and force-disable block validation ;-(
authorAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 26 Sep 2021 12:49:23 +0000 (15:49 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 26 Sep 2021 12:49:23 +0000 (15:49 +0300)
commitdefe805fb763f3d4b11cbbe3dde460b825eea1ae
tree1cb0a06d6cf0ffa03b9e48944c2b627d3fd99a65
parent06181008551b4f920d6e91e1f6bc270d78428bc6
internal: fix and force-disable block validation ;-(

Originally we tried to maintain the invariant that `{}` always match.
That is, that in the parse tree the pair of corresponding `{}` is always
first and last tokens of some nodes.

We had the code to validate that, but apparently it's been broken for
**years** since we introduced tokens/nodes split. Fixing it now makes
some tests fail.

It's unclear if we want to keep this invariant: there's a strong
motivation for breaking it in the following case:

```
use std::{ // unclosed paren

fn main() {

}

} // don't actually want to pair up this with the one from `use`
```

So let's fix the code, but disable it for the time being
crates/syntax/src/lib.rs
crates/syntax/src/syntax_node.rs
crates/syntax/src/validation.rs