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

fly check panic #18954

Open
qjerome opened this issue Jan 16, 2025 · 5 comments
Open

fly check panic #18954

qjerome opened this issue Jan 16, 2025 · 5 comments
Labels
C-bug Category: bug

Comments

@qjerome
Copy link
Contributor

qjerome commented Jan 16, 2025

rust-analyzer version: 0.3.2264

rustc version: rustc 1.81.0 (eeb90cda1 2024-09-04)

editor or extension: VSCode

I am getting this error:

2025-01-16T14:02:42.513421189+01:00 ERROR flycheck task panicked: Any { .. }
thread 'Worker' panicked at crates/rust-analyzer/src/handlers/notification.rs:333:25:
index out of bounds: the len is 1 but the index is 1
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_bounds_check
   3: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
2025-01-16T14:02:45.05267552+01:00 ERROR flycheck task panicked: Any { .. }

I checked the code at https://github.com/rust-lang/rust-analyzer/blob/1f717b0acdccf6969655a8a1ddf6b718dfba6ca6/crates/rust-analyzer/src/handlers/notification.rs#L333C1-L333C82 and it seems the accessed index is not checked against OOB access. As I am not very familiar with the r-a code base I am tempted to fix this just checking that idx is in bounds using get methods instead of [] access but maybe it is the symptom of an issue that needs to be corrected elsewhere in the code.

Cheers,

@qjerome qjerome added the C-bug Category: bug label Jan 16, 2025
@Veykril
Copy link
Member

Veykril commented Jan 16, 2025

There seems to be something else going on, the index there should always be in bounds, though we might be racing when the workspaces switch.

@qjerome
Copy link
Contributor Author

qjerome commented Jan 16, 2025

Let me know if I can help diagnosing the issue

@ChayimFriedman2
Copy link
Contributor

Do you have a reproduction?

@qjerome
Copy link
Contributor Author

qjerome commented Jan 16, 2025

I just have my huge project requiring some setup ... I would need to figure out how to repro the issue on a small repository but I have not the time for this right now !

@qjerome
Copy link
Contributor Author

qjerome commented Jan 20, 2025

I tried to build a minimal repro project for several hours but in vain ... Yet I do still have the error even with the latest version of r-a.
The link to my project, where I have the issue is: https://github.com/kunai-project/kunai

The particularities of that project that may trigger the error above are the following:

  • a cargo workspace running on Rust stable toolchain
  • a rust-analyzer.linkedProjects running on nightly Rust because it needs a custom target only available in nightly
  • several cargo related tasks are actually handled by a custom xtask: such as clippy, build, run ... (see cargo xtask -h for details)

I hope this will help you ...

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

No branches or pull requests

3 participants