rust-analyzer
rust-analyzer copied to clipboard
Navigate to symbol doesn't work outside of a macro
rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P) 0.3.2474-standalone
rustc version: (eg. output of rustc -V)
editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable) VSCODE
relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)
None
repository link (if public, optional): (eg. rust-analyzer)
- https://github.com/rust-lang/rust-analyzer
- revision ed608f592e0a038db4d03ed4af58fd171bd3b3c0qqq
- file crates/rust-analyzer/src/cli/run_tests.rs
- line 63: let result = test.eval(db, span_formatter);
- navigate to symbol doesn't work on eval
I can't reproduce.
@ChayimFriedman2 If it helps, here's debug logging with RA_LOG=DEBUG:
thread 'Worker13' panicked at /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chalk-ir-0.102.0/src/debug.rs:156:13:
not implemented: cannot format ProjectionTy without setting Program in tls
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: <&T as core::fmt::Debug>::fmt
3: core::fmt::write
4: <tracing_subscriber::fmt::format::DefaultVisitor as tracing_core::field::Visit>::record_debug
5: tracing_core::field::ValueSet::record
6: <tracing_subscriber::fmt::format::Format<tracing_subscriber::fmt::format::Full,T> as tracing_subscriber::fmt::format::FormatEvent<S,N>>::format_event
7: std::thread::local::LocalKey<T>::with
8: <tracing_subscriber::fmt::fmt_layer::Layer<S,N,E,W> as tracing_subscriber::layer::Layer<S>>::on_event
9: std::thread::local::LocalKey<T>::with
10: <tracing_subscriber::filter::layer_filters::Filtered<L,F,S> as tracing_subscriber::layer::Layer<S>>::on_event
11: <tracing_subscriber::layer::layered::Layered<L,S> as tracing_core::subscriber::Subscriber>::event
12: <tracing_subscriber::layer::layered::Layered<L,S> as tracing_core::subscriber::Subscriber>::event
13: chalk_solve::clauses::builder::ClauseBuilder<I>::push_binders
14: chalk_solve::clauses::program_clauses_that_could_match
15: chalk_recursive::solve::SolveIteration::solve_iteration
16: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
17: chalk_recursive::solve::SolveIteration::solve_iteration
18: <chalk_recursive::recursive::RecursiveSolver<I> as chalk_solve::solve::Solver<I>>::solve_limited
19: hir_ty::traits::trait_solve_query
20: salsa::function::execute::<impl salsa::function::IngredientImpl<C>>::execute
21: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold_with_retry
22: std::thread::local::LocalKey<T>::with
23: <DB as hir_ty::db::HirDatabase>::trait_solve::trait_solve_shim
24: <DB as hir_ty::db::HirDatabase>::trait_solve
25: hir_ty::infer::unify::InferenceTable::register_obligation_in_env
26: hir_ty::infer::unify::InferenceTable::normalize_projection_ty
27: hir_ty::fold_tys_and_consts::_::<impl chalk_ir::fold::FallibleTypeFolder<hir_ty::interner::Interner> for hir_ty::fold_tys_and_consts::TyFolder<F>>::try_fold_ty
28: chalk_ir::fold::TypeSuperFoldable::super_fold_with
29: hir_ty::fold_tys_and_consts::_::<impl chalk_ir::fold::FallibleTypeFolder<hir_ty::interner::Interner> for hir_ty::fold_tys_and_consts::TyFolder<F>>::try_fold_ty
30: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::check_call
31: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
32: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr
33: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
34: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr
35: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_block
36: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
37: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_return
38: hir_ty::infer::infer_query
39: salsa::function::execute::<impl salsa::function::IngredientImpl<C>>::execute
40: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold_with_retry
41: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch
42: hir::semantics::SemanticsImpl::analyze_impl
43: hir::semantics::SemanticsImpl::resolve_method_call_as_callable
44: ide::goto_definition::goto_definition
45: salsa::cancelled::Cancelled::catch
46: ide::Analysis::goto_definition
47: rust_analyzer::handlers::request::handle_goto_definition
48: core::ops::function::FnOnce::call_once{{vtable.shim}}
49: <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.
query stacktrace:
0: trait_solve_shim(Id(8c035)) -> (R6170, Durability::LOW)
at crates/hir-ty/src/db.rs:31
1: infer_shim(Id(a0931)) -> (R6170, Durability::LOW)
at crates/hir-ty/src/db.rs:31
additional context:
0:
version: 0.3.2474-standalone
request: textDocument/definition GotoDefinitionParams {
text_document_position_params: TextDocumentPositionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: #CENSORED#
query: None,
fragment: None,
},
},
position: Position {
line: 62,
character: 32,
},
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}
2025-05-28T21:31:49.830906937-04:00 DEBUG GlobalState::handle_event{event=Event::Task}: handle_event loop_start=Instant { tv_sec: 692357, tv_nsec: 13301376 } event=Response { id: RequestId(I32(45)), error: Some(ResponseError { code: -32603, message: "request handler panicked: not implemented: cannot format ProjectionTy without setting Program in tls", data: None }) }
2025-05-28T21:31:49.830922486-04:00 DEBUG GlobalState::handle_event{event=Event::Task}:GlobalState::handle_event/task: method="textDocument/definition" response.id=45 duration=6.81ms
[Error - 9:31:49 PM] Request textDocument/definition failed.
Message: request handler panicked: not implemented: cannot format ProjectionTy without setting Program in tls
Code: -32603
Oh you have logging enabled... That's still a bug we need to fix, but you can disable logging to workaround it.
@ChayimFriedman2 I turned on logging just to see what's going on. It's very slow with it, and thanks for fixing the issue.
The logging is the cause of the panic. Perhaps you have it enabled unknowingly?
@ChayimFriedman2 Ok. Thanks. I didn't enable it unknowingly, I enabled it on purpose to help understand what's going on. May be you could add some diagnostic to understand why it can't resolve the reference?
Let's break it down: the panic is caused because of the logging. Without logging it resolves for me. Try disabling logging and see if it resolves, and if there are still panics.
@ChayimFriedman2 As I said, it doesn't resolve both with and without logging.
Is there a panic in the logs without logging?
@ChayimFriedman2 There're no panics.
Well, then the panics are a different issue, and we still need to find why it doesn't work for you.
Closed it, since it's probably obsolete.