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

RA panics with file #15298

Closed
The-Minecraft-Scientist opened this issue Jul 17, 2023 · 7 comments
Closed

RA panics with file #15298

The-Minecraft-Scientist opened this issue Jul 17, 2023 · 7 comments
Labels
A-macro macro expansion C-bug Category: bug I-panic

Comments

@The-Minecraft-Scientist
Copy link

The-Minecraft-Scientist commented Jul 17, 2023

The attached main.txt, pasted into main.rs in a default cargo new --bin project causes RA to panic (tested with VSCodium on mac and VS Code on windows). I apologize in advance for the ugly code :)

(these are the versions that I tested on Mac. I don't know the exact version my friend (who tested on windows) was using, but it's likely fairly recent))
rust-analyzer version: rust-analyzer version: 0.3.1583-standalone (ff15634 2023-07-09)

rustc version: rustc 1.70.0 (90c541806 2023-05-31)

example:
main.txt

more minimized example:
main.txt

panic backtrace
Panic context:
> publish_diagnostics

thread 'Worker' panicked at 'Bad range: node range 35..137, range 246..251', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rowan-0.15.11/src/cursor.rs:786:13
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: rowan::cursor::SyntaxNode::covering_element
   3: hir_expand::ExpansionInfo::map_token_up
   4: hir_expand::ascend_call_token
   5: hir_expand::ascend_node_border_tokens
   6: hir_expand::InFile<&rowan::api::SyntaxNode<syntax::syntax_node::RustLanguage>>::original_file_range_opt
   7: hir_expand::InFile<&rowan::api::SyntaxNode<syntax::syntax_node::RustLanguage>>::original_file_range
   8: hir::semantics::SemanticsImpl::diagnostics_display_range
   9: ide_diagnostics::adjusted_display_range
  10: ide_diagnostics::handlers::type_mismatch::type_mismatch
  11: ide_diagnostics::diagnostics
  12: std::panicking::try
  13: ide::Analysis::diagnostics
  14: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
  15: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
  16: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@The-Minecraft-Scientist The-Minecraft-Scientist added the C-bug Category: bug label Jul 17, 2023
@The-Minecraft-Scientist
Copy link
Author

I managed to reduce this pretty significantly by trial and error, I’ll upload the new file as soon as I can

@lowr
Copy link
Contributor

lowr commented Jul 18, 2023

#15248 may have fixed this. Can you try the latest release (2023-07-17, v0.3.1591) and see if the panic persists?

@lowr lowr added A-macro macro expansion I-panic labels Jul 18, 2023
@The-Minecraft-Scientist
Copy link
Author

will do!

@The-Minecraft-Scientist
Copy link
Author

Closing this as fixed! Latest Rust-Analyzer no longer panics with my file. Thanks!

@lnicola
Copy link
Member

lnicola commented Jul 20, 2023

Closing for real 😀.

@lnicola lnicola closed this as completed Jul 20, 2023
@pacak
Copy link

pacak commented Sep 10, 2023

I'm getting a similar looking stack trace in 1.72.0 (5680fa1 2023-08-23)

@pacak
Copy link

pacak commented Sep 10, 2023

sample.tar.gz

removing match item { on line 183 causes the crash.

crash.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro macro expansion C-bug Category: bug I-panic
Projects
None yet
Development

No branches or pull requests

4 participants