mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-13 09:11:51 +00:00
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
This commit is contained in:
parent
0618100855
commit
defe805fb7
3 changed files with 5 additions and 8 deletions
|
|
@ -47,7 +47,7 @@ impl SyntaxTreeBuilder {
|
|||
|
||||
pub fn finish(self) -> Parse<SyntaxNode> {
|
||||
let (green, errors) = self.finish_raw();
|
||||
if cfg!(debug_assertions) {
|
||||
if cfg!(debug_assertions) && false {
|
||||
let node = SyntaxNode::new_root(green.clone());
|
||||
crate::validation::validate_block_structure(&node);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue