Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash when typing println!(" in Rust: ts_parser__handle_error: Assertion `did_merge' failed #28265

Open
ckp95 opened this issue Apr 10, 2024 · 3 comments
Labels
bug-crash issue reporting a crash or segfault has:backtrace issue contains a stacktrace/ASAN log treesitter

Comments

@ckp95
Copy link

ckp95 commented Apr 10, 2024

Problem

When working on a project I found that Neovim would consistently crash in a certain Rust file whenever I typed the characters println!(". It would crash exactly when I typed the ". The error message flashes up only for a frame or so, but I caught it in a recording:

Screencast_20240410_211134.webm

I reduced the file to the following minimal example:

fn main() {
    println!("");
    for x in y {
        if true {
            true;
        } else {
            println!("");
        }
    }
}

Typing println!(" in the function makes it crash. As far as I can tell, removing any other aspect of the function body suppresses the error. e.g. removing the loop body, removing branches of the if expression, removing either of the printlns.

Also, running TSBufDisable highlight prevents the crash, so presumably it is treesitter-related.

Steps to reproduce

Stacktrace:

bt.txt

My neovim flake, it's not minimal but you should be able to reproduce the problem since everything is pinned:

https://github.com/ckp95/nvflake

Expected behavior

It should not crash when I type println!("

Neovim version (nvim -v)

v0.9.5

Vim (not Nvim) behaves the same?

idk

Operating system/version

NixOS 24.05

Terminal name/version

konsole 24.02.0

$TERM environment variable

xterm-256color

Installation

custom Nix flake

@ckp95 ckp95 added the bug issues reporting wrong behavior label Apr 10, 2024
@zeertzjq zeertzjq added has:backtrace issue contains a stacktrace/ASAN log bug-crash issue reporting a crash or segfault treesitter and removed bug issues reporting wrong behavior labels Apr 10, 2024
@lucario387
Copy link
Contributor

Sounds like tree-sitter/tree-sitter-rust#215

@ckp95
Copy link
Author

ckp95 commented Apr 14, 2024

Sounds like tree-sitter/tree-sitter-rust#215

It's not quite the same. I can write that example and it doesn't crash for me:

fn main () {
    panic!("hello");
}

@Gauravst
Copy link

same with html ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-crash issue reporting a crash or segfault has:backtrace issue contains a stacktrace/ASAN log treesitter
Projects
None yet
Development

No branches or pull requests

4 participants