rust-lang / rust-lang/rust-analyzer
rust_analyzer: -32603
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Getting a panic with this error on the following versions, with the following code,
rustv: 1.93
rust-analyzer: 0.3.2777
editor: both neovim and vscode
following log is from vscode (i get the same error on neovim):
thread 'Worker1' (289180) panicked at /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ra-ap-rustc_type_ir-0.143.0/src/binder.rs:649:13:
&'{region error} mut #0 has parameters, but no args were provided in instantiate
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: ra_ap_rustc_type_ir::binder::EarlyBinder<I,T>::instantiate
3: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
4: alloc::vec::in_place_collect::from_iter_in_place
5: hir::Function::params_without_self_with_args
6: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
7: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
8: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
9: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
10: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
11: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
12: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
13: hir::term_search::term_search
14: ide_diagnostics::handlers::typed_hole::typed_hole
15: ide_diagnostics::semantic_diagnostics
16: ide_diagnostics::full_diagnostics
17: salsa::cancelled::Cancelled::catch
18: ide::Analysis::full_diagnostics
19: rust_analyzer::handlers::request::handle_document_diagnostics
20: core::ops::function::FnOnce::call_once{{vtable.shim}}
21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
additional context:
0:
version: 0.3.2777-standalone
request: textDocument/diagnostic DocumentDiagnosticParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/yarn/prg/exp/rst1/src/main.rs",
query: None,
fragment: None,
},
},
identifier: Some(
"rust-analyzer",
),
previous_result_id: Some(
"rust-analyzer",
),
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}
thread 'Worker6' (289185) panicked at /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ra-ap-rustc_type_ir-0.143.0/src/binder.rs:649:13:
&'{region error} mut #0 has parameters, but no args were provided in instantiate
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: ra_ap_rustc_type_ir::binder::EarlyBinder<I,T>::instantiate
3: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
4: alloc::vec::in_place_collect::from_iter_in_place
5: hir::Function::params_without_self_with_args
6: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
7: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
8: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
9: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
10: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
11: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
12: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
13: hir::term_search::term_search
14: ide_diagnostics::handlers::typed_hole::typed_hole
15: ide_diagnostics::semantic_diagnostics
16: ide_diagnostics::full_diagnostics
17: salsa::cancelled::Cancelled::catch
18: ide::Analysis::full_diagnostics
19: rust_analyzer::handlers::request::handle_document_diagnostics
20: core::ops::function::FnOnce::call_once{{vtable.shim}}
21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
additional context:
0:
version: 0.3.2777-standalone
request: textDocument/diagnostic DocumentDiagnosticParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/yarn/prg/exp/rst1/src/main.rs",
query: None,
fragment: None,
},
},
identifier: Some(
"rust-analyzer",
),
previous_result_id: None,
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}
[Error - 10:17:15] Request textDocument/diagnostic failed.
Message: request handler panicked: &'{region error} mut #0 has parameters, but no args were provided in instantiate
Code: -32603
[Error - 10:17:15] Document pull failed for text document file:///home/yarn/prg/exp/rst1/src/main.rs
Message: request handler panicked: &'{region error} mut #0 has parameters, but no args were provided in instantiate
Code: -32603
thread 'Worker0' (289179) panicked at /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ra-ap-rustc_type_ir-0.143.0/src/binder.rs:649:13:
&'{region error} mut #0 has parameters, but no args were provided in instantiate
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: ra_ap_rustc_type_ir::binder::EarlyBinder<I,T>::instantiate
3: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
4: alloc::vec::in_place_collect::from_iter_in_place
5: hir::Function::params_without_self_with_args
6: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
7: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
8: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
9: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
10: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
11: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
12: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
13: hir::term_search::term_search
14: ide_diagnostics::handlers::typed_hole::typed_hole
15: ide_diagnostics::semantic_diagnostics
16: ide_diagnostics::full_diagnostics
17: salsa::cancelled::Cancelled::catch
18: std::thread::local::LocalKey<T>::with
19: ide::Analysis::assists_with_fixes
20: rust_analyzer::handlers::request::handle_code_action
21: core::ops::function::FnOnce::call_once{{vtable.shim}}
22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
additional context:
0:
version: 0.3.2777-standalone
request: textDocument/codeAction CodeActionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/yarn/prg/exp/rst1/src/main.rs",
query: None,
fragment: None,
},
},
range: Range {
start: Position {
line: 4,
character: 7,
},
end: Position {
line: 4,
character: 7,
},
},
context: CodeActionContext {
diagnostics: [],
only: None,
trigger_kind: Some(
Automatic,
),
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}
In a project with just the following main.rs (stable, edition=2024, version=4)
I can reproduce the panic by typing let<space> on the line below let val = Box::leak(Box::new(Mutex::new(1u64)));.
main.rs:
use std::{sync::Mutex, thread, time::Duration};
fn some_fn() {
let val = Box::leak(Box::new(Mutex::new(1u64))); // type `let<space>` on next line
for _ in 0..2 {
thread::spawn(|| {
loop {
thread::sleep(Duration::from_secs(1));
*(val.lock().unwrap()) += 1;
}
});
}
loop {
println!("t3...{}", *val.lock().unwrap());
thread::sleep(Duration::from_millis(250));
}
}
fn main() {
some_fn();
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the panic with the minimal main.rs by typing let below the Box::leak statement. Start at the rust_analyzer handlers for textDocument/diagnostic and textDocument/codeAction, then trace through hir::Function::params_without_self_with_args, term_search, and typed_hole. Done means both requests handle this example without panicking, with regression coverage for the reproducer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100