Skip to content

inter panic Internal error, cycle detected #8686

New issue

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

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

Already on GitHub? # to your account

Closed
756445638 opened this issue Apr 29, 2021 · 10 comments · Fixed by #8692
Closed

inter panic Internal error, cycle detected #8686

756445638 opened this issue Apr 29, 2021 · 10 comments · Fixed by #8692
Labels
Broken Window Bugs / technical debt to be addressed immediately S-actionable Someone could pick this issue up and work on it right now

Comments

@756445638
Copy link

756445638 commented Apr 29, 2021

yuyang@yuyang-PC:~/firefox$ /home/yuyang/.config/Code/User/globalStorage/matklad.rust-analyzer/rust-analyzer-linux --version
rust-analyzer dbd0cfb

Panic context:

request: textDocument/codeAction CodeActionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
host: None,
port: None,
path: "/home/yuyang/lsp-server/src/lib.rs",
query: None,
fragment: None,
},
},
range: Range {
start: Position {
line: 28,
character: 17,
},
end: Position {
line: 28,
character: 17,
},
},
context: CodeActionContext {
diagnostics: [],
only: None,
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}

thread '' panicked at 'Internal error, cycle detected:

DatabaseKeyIndex { group_index: 7, query_index: 10, key_index: 488 }
DatabaseKeyIndex { group_index: 7, query_index: 8, key_index: 45 }
', /home/runner/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/salsa-0.16.0/src/lib.rs:490:48
stack backtrace:
0: rust_begin_unwind
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
1: std::panicking::begin_panic_fmt
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:437
2: salsa::QueryTable::get::{{closure}}
3: ::generic_defaults::__shim
4: ::generic_defaults
5: hir_ty::lower::substs_from_path_segment
6: hir_ty::lower::::from_resolved_path
7: hir_ty::lower::::from_path
8: hir_ty::lower::::from_type_bound
9: hir_ty::lower::::from_where_predicate
10: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next
11: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
12: hir_ty::lower::generic_predicates_for_param_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::read
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
17: ::generic_predicates_for_param::__shim
18: ::generic_predicates_for_param
19: hir_ty::utils::all_super_trait_refs
20: hir_ty::utils::associated_type_by_name_including_super_traits
21: hir_ty::lower::::from_partly_resolved_hir_path
22: hir_ty::lower::::from_hir_ext
23: core::ops::function::impls::<impl core::ops::function::FnOnce for &mut F>::call_once
24: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
25: hir_ty::lower::generic_defaults_query
26: salsa::runtime::Runtime::execute_query_implementation
27: salsa::derived::slot::Slot<Q,MP>::read_upgrade
28: salsa::derived::slot::Slot<Q,MP>::read
29: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
30: ::generic_defaults::__shim
31: ::generic_defaults
32: hir_ty::lower::substs_from_path_segment
33: hir_ty::lower::::from_resolved_path
34: hir_ty::lower::::from_path
35: hir_ty::lower::impl_trait_query
36: salsa::runtime::Runtime::execute_query_implementation
37: salsa::derived::slot::Slot<Q,MP>::read_upgrade
38: salsa::derived::slot::Slot<Q,MP>::read
39: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
40: ::impl_trait::__shim
41: ::impl_trait
42: hir_ty::method_resolution::TraitImpls::trait_impls_in_crate_query
43: salsa::runtime::Runtime::execute_query_implementation
44: salsa::derived::slot::Slot<Q,MP>::read_upgrade
45: salsa::derived::slot::Slot<Q,MP>::read
46: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
47: ::trait_impls_in_crate::__shim
48: hir_ty::method_resolution::TraitImpls::trait_impls_in_deps_query
49: salsa::runtime::Runtime::execute_query_implementation
50: salsa::derived::slot::Slot<Q,MP>::read_upgrade
51: salsa::derived::slot::Slot<Q,MP>::read
52: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
53: ::trait_impls_in_deps::__shim
54: hir_ty::traits::chalk::<impl chalk_solve::RustIrDatabase<hir_ty::traits::chalk::interner::Interner> for hir_ty::traits::ChalkContext>::impls_for_trait
55: chalk_solve::clauses::program_clauses_for_goal
56: <chalk_recursive::recursive::Solver as chalk_recursive::solve::SolveDatabase>::solve_goal
57: <chalk_recursive::recursive::RecursiveSolver as chalk_solve::solve::Solver>::solve_limited
58: hir_ty::traits::trait_solve_query
59: salsa::runtime::Runtime::execute_query_implementation
60: salsa::derived::slot::Slot<Q,MP>::read_upgrade
61: salsa::derived::slot::Slot<Q,MP>::read
62: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
63: salsa::QueryTable::get
64: ::trait_solve::__shim
65: ::trait_solve
66: hir_ty::autoderef::deref
67: <core::iter::sources::Successors<T,F> as core::iter::traits::iterator::Iterator>::next
68: core::iter::traits::iterator::Iterator::find_map
69: hir_ty::infer::expr::::infer_expr_inner
70: hir_ty::infer::expr::::infer_expr_coerce
71: hir_ty::infer::expr::::infer_block
72: hir_ty::infer::expr::::infer_expr_inner
73: hir_ty::infer::expr::::infer_expr_coerce
74: hir_ty::infer::infer_query
75: salsa::runtime::Runtime::execute_query_implementation
76: salsa::derived::slot::Slot<Q,MP>::read_upgrade
77: salsa::derived::slot::Slot<Q,MP>::read
78: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
79: ::infer_query::__shim
80: hir_ty::db::infer_wait
81: hir_ty::diagnostics::validate_body
82: hir::code_model::Module::diagnostics
83: ide::diagnostics::diagnostics
84: ide::Analysis::diagnostics
85: rust_analyzer::handlers::handle_code_action
86: ::call_box
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.
Panic context:

request: textDocument/definition GotoDefinitionParams {
text_document_position_params: TextDocumentPositionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
host: None,
port: None,
path: "/home/yuyang/lsp-server/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position {
line: 32,
character: 43,
},
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}

thread '' panicked at 'Internal error, cycle detected:

DatabaseKeyIndex { group_index: 7, query_index: 10, key_index: 488 }
DatabaseKeyIndex { group_index: 7, query_index: 8, key_index: 45 }
', /home/runner/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/salsa-0.16.0/src/lib.rs:490:48
stack backtrace:
0: rust_begin_unwind
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
1: std::panicking::begin_panic_fmt
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:437
2: salsa::QueryTable::get::{{closure}}
3: ::generic_defaults::__shim
4: ::generic_defaults
5: hir_ty::lower::substs_from_path_segment
6: hir_ty::lower::::from_resolved_path
7: hir_ty::lower::::from_path
8: hir_ty::lower::::from_type_bound
9: hir_ty::lower::::from_where_predicate
10: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next
11: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
12: hir_ty::lower::generic_predicates_for_param_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::read
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
17: ::generic_predicates_for_param::__shim
18: ::generic_predicates_for_param
19: hir_ty::utils::all_super_trait_refs
20: hir_ty::utils::associated_type_by_name_including_super_traits
21: hir_ty::lower::::from_partly_resolved_hir_path
22: hir_ty::lower::::from_hir_ext
23: core::ops::function::impls::<impl core::ops::function::FnOnce
for &mut F>::call_once
24: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
25: hir_ty::lower::generic_defaults_query
26: salsa::runtime::Runtime::execute_query_implementation
27: salsa::derived::slot::Slot<Q,MP>::read_upgrade
28: salsa::derived::slot::Slot<Q,MP>::read
29: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
30: ::generic_defaults::__shim
31: ::generic_defaults
32: hir_ty::lower::substs_from_path_segment
33: hir_ty::lower::::from_resolved_path
34: hir_ty::lower::::from_path
35: hir_ty::lower::impl_trait_query
36: salsa::runtime::Runtime::execute_query_implementation
37: salsa::derived::slot::Slot<Q,MP>::read_upgrade
38: salsa::derived::slot::Slot<Q,MP>::read
39: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
40: ::impl_trait::__shim
41: ::impl_trait
42: hir_ty::method_resolution::TraitImpls::trait_impls_in_crate_query
43: salsa::runtime::Runtime::execute_query_implementation
44: salsa::derived::slot::Slot<Q,MP>::read_upgrade
45: salsa::derived::slot::Slot<Q,MP>::read
46: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
47: ::trait_impls_in_crate::__shim
48: hir_ty::method_resolution::TraitImpls::trait_impls_in_deps_query
49: salsa::runtime::Runtime::execute_query_implementation
50: salsa::derived::slot::Slot<Q,MP>::read_upgrade
51: salsa::derived::slot::Slot<Q,MP>::read
52: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
53: ::trait_impls_in_deps::__shim
54: hir_ty::traits::chalk::<impl chalk_solve::RustIrDatabase<hir_ty::traits::chalk::interner::Interner> for hir_ty::traits::ChalkContext>::impls_for_trait
55: chalk_solve::clauses::program_clauses_for_goal
56: <chalk_recursive::recursive::Solver as chalk_recursive::solve::SolveDatabase>::solve_goal
57: <chalk_recursive::recursive::RecursiveSolver as chalk_solve::solve::Solver>::solve_limited
58: hir_ty::traits::trait_solve_query
59: salsa::runtime::Runtime::execute_query_implementation
60: salsa::derived::slot::Slot<Q,MP>::read_upgrade
61: salsa::derived::slot::Slot<Q,MP>::read
62: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
63: salsa::QueryTable::get
64: ::trait_solve::__shim
65: ::trait_solve
66: hir_ty::autoderef::deref
67: <core::iter::sources::Successors<T,F> as core::iter::traits::iterator::Iterator>::next
68: core::iter::traits::iterator::Iterator::find_map
69: hir_ty::infer::expr::::infer_expr_inner
70: hir_ty::infer::expr::::infer_expr_coerce
71: hir_ty::infer::expr::::infer_block
72: hir_ty::infer::expr::::infer_expr_inner
73: hir_ty::infer::expr::::infer_expr_coerce
74: hir_ty::infer::infer_query
75: salsa::runtime::Runtime::execute_query_implementation
76: salsa::derived::slot::Slot<Q,MP>::read_upgrade
77: salsa::derived::slot::Slot<Q,MP>::read
78: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
79: ::infer_query::__shim
80: hir_ty::db::infer_wait
81: hir::source_analyzer::SourceAnalyzer::new_for_body
82: hir::semantics::SemanticsImpl::analyze_impl
83: hir::semantics::SemanticsImpl::descend_into_macros
84: ide::goto_definition::goto_definition
85: ide::Analysis::goto_definition
86: rust_analyzer::handlers::handle_goto_definition
87: ::call_box
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.
Panic context:

request: textDocument/documentHighlight DocumentHighlightParams {
text_document_position_params: TextDocumentPositionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
host: None,
port: None,
path: "/home/yuyang/lsp-server/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position {
line: 32,
character: 40,
},
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}

thread '' panicked at 'Internal error, cycle detected:

DatabaseKeyIndex { group_index: 7, query_index: 10, key_index: 488 }
DatabaseKeyIndex { group_index: 7, query_index: 8, key_index: 45 }
', /home/runner/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/salsa-0.16.0/src/lib.rs:490:48
stack backtrace:
0: rust_begin_unwind
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
1: std::panicking::begin_panic_fmt
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:437
2: salsa::QueryTable::get::{{closure}}
3: ::generic_defaults::__shim
4: ::generic_defaults
5: hir_ty::lower::substs_from_path_segment
6: hir_ty::lower::::from_resolved_path
7: hir_ty::lower::::from_path
8: hir_ty::lower::::from_type_bound
9: hir_ty::lower::::from_where_predicate
10: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next
11: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
12: hir_ty::lower::generic_predicates_for_param_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::read
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
17: ::generic_predicates_for_param::__shim
18: ::generic_predicates_for_param
19: hir_ty::utils::all_super_trait_refs
20: hir_ty::utils::associated_type_by_name_including_super_traits
21: hir_ty::lower::::from_partly_resolved_hir_path
22: hir_ty::lower::::from_hir_ext
23: core::ops::function::impls::<impl core::ops::function::FnOnce
for &mut F>::call_once
24: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
25: hir_ty::lower::generic_defaults_query
26: salsa::runtime::Runtime::execute_query_implementation
27: salsa::derived::slot::Slot<Q,MP>::read_upgrade
28: salsa::derived::slot::Slot<Q,MP>::read
29: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
30: ::generic_defaults::__shim
31: ::generic_defaults
32: hir_ty::lower::substs_from_path_segment
33: hir_ty::lower::::from_resolved_path
34: hir_ty::lower::::from_path
35: hir_ty::lower::impl_trait_query
36: salsa::runtime::Runtime::execute_query_implementation
37: salsa::derived::slot::Slot<Q,MP>::read_upgrade
38: salsa::derived::slot::Slot<Q,MP>::read
39: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
40: ::impl_trait::__shim
41: ::impl_trait
42: hir_ty::method_resolution::TraitImpls::trait_impls_in_crate_query
43: salsa::runtime::Runtime::execute_query_implementation
44: salsa::derived::slot::Slot<Q,MP>::read_upgrade
45: salsa::derived::slot::Slot<Q,MP>::read
46: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
47: ::trait_impls_in_crate::__shim
48: hir_ty::method_resolution::TraitImpls::trait_impls_in_deps_query
49: salsa::runtime::Runtime::execute_query_implementation
50: salsa::derived::slot::Slot<Q,MP>::read_upgrade
51: salsa::derived::slot::Slot<Q,MP>::read
52: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
53: ::trait_impls_in_deps::__shim
54: hir_ty::traits::chalk::<impl chalk_solve::RustIrDatabase<hir_ty::traits::chalk::interner::Interner> for hir_ty::traits::ChalkContext>::impls_for_trait
55: chalk_solve::clauses::program_clauses_for_goal
56: <chalk_recursive::recursive::Solver as chalk_recursive::solve::SolveDatabase>::solve_goal
57: <chalk_recursive::recursive::RecursiveSolver as chalk_solve::solve::Solver>::solve_limited
58: hir_ty::traits::trait_solve_query
59: salsa::runtime::Runtime::execute_query_implementation
60: salsa::derived::slot::Slot<Q,MP>::read_upgrade
61: salsa::derived::slot::Slot<Q,MP>::read
62: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
63: salsa::QueryTable::get
64: ::trait_solve::__shim
65: ::trait_solve
66: hir_ty::autoderef::deref
67: <core::iter::sources::Successors<T,F> as core::iter::traits::iterator::Iterator>::next
68: core::iter::traits::iterator::Iterator::find_map
69: hir_ty::infer::expr::::infer_expr_inner
70: hir_ty::infer::expr::::infer_expr_coerce
71: hir_ty::infer::expr::::infer_block
72: hir_ty::infer::expr::::infer_expr_inner
73: hir_ty::infer::expr::::infer_expr_coerce
74: hir_ty::infer::infer_query
75: salsa::runtime::Runtime::execute_query_implementation
76: salsa::derived::slot::Slot<Q,MP>::read_upgrade
77: salsa::derived::slot::Slot<Q,MP>::read
78: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
79: ::infer_query::__shim
80: hir_ty::db::infer_wait
81: hir::source_analyzer::SourceAnalyzer::new_for_body
82: hir::semantics::SemanticsImpl::analyze_impl
83: hir::semantics::SemanticsImpl::descend_into_macros
84: rowan::utility_types::TokenAtOffset::map
85: hir::semantics::SemanticsImpl::descend_node_at_offset
86: hir::semantics::Semantics::find_node_at_offset_with_descend
87: ide::references::find_all_refs
88: ide::Analysis::find_all_refs::{{closure}}
89: std::panicking::try
90: ide::Analysis::find_all_refs
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.
Panic context:

request: textDocument/definition GotoDefinitionParams {
text_document_position_params: TextDocumentPositionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
host: None,
port: None,
path: "/home/yuyang/lsp-server/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position {
line: 32,
character: 40,
},
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}

thread '' panicked at 'Internal error, cycle detected:

DatabaseKeyIndex { group_index: 7, query_index: 10, key_index: 488 }
DatabaseKeyIndex { group_index: 7, query_index: 8, key_index: 45 }
', /home/runner/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/salsa-0.16.0/src/lib.rs:490:48
stack backtrace:
0: rust_begin_unwind
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
1: std::panicking::begin_panic_fmt
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:437
2: salsa::QueryTable::get::{{closure}}
3: ::generic_defaults::__shim
4: ::generic_defaults
5: hir_ty::lower::substs_from_path_segment
6: hir_ty::lower::::from_resolved_path
7: hir_ty::lower::::from_path
8: hir_ty::lower::::from_type_bound
9: hir_ty::lower::::from_where_predicate
10: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next
11: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
12: hir_ty::lower::generic_predicates_for_param_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::read
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
17: ::generic_predicates_for_param::__shim
18: ::generic_predicates_for_param
19: hir_ty::utils::all_super_trait_refs
20: hir_ty::utils::associated_type_by_name_including_super_traits
21: hir_ty::lower::::from_partly_resolved_hir_path
22: hir_ty::lower::::from_hir_ext
23: core::ops::function::impls::<impl core::ops::function::FnOnce
for &mut F>::call_once
24: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
25: hir_ty::lower::generic_defaults_query
26: salsa::runtime::Runtime::execute_query_implementation
27: salsa::derived::slot::Slot<Q,MP>::read_upgrade
28: salsa::derived::slot::Slot<Q,MP>::read
29: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
30: ::generic_defaults::__shim
31: ::generic_defaults
32: hir_ty::lower::substs_from_path_segment
33: hir_ty::lower::::from_resolved_path
34: hir_ty::lower::::from_path
35: hir_ty::lower::impl_trait_query
36: salsa::runtime::Runtime::execute_query_implementation
37: salsa::derived::slot::Slot<Q,MP>::read_upgrade
38: salsa::derived::slot::Slot<Q,MP>::read
39: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
40: ::impl_trait::__shim
41: ::impl_trait
42: hir_ty::method_resolution::TraitImpls::trait_impls_in_crate_query
43: salsa::runtime::Runtime::execute_query_implementation
44: salsa::derived::slot::Slot<Q,MP>::read_upgrade
45: salsa::derived::slot::Slot<Q,MP>::read
46: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
47: ::trait_impls_in_crate::__shim
48: hir_ty::method_resolution::TraitImpls::trait_impls_in_deps_query
49: salsa::runtime::Runtime::execute_query_implementation
50: salsa::derived::slot::Slot<Q,MP>::read_upgrade
51: salsa::derived::slot::Slot<Q,MP>::read
52: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
53: ::trait_impls_in_deps::__shim
54: hir_ty::traits::chalk::<impl chalk_solve::RustIrDatabase<hir_ty::traits::chalk::interner::Interner> for hir_ty::traits::ChalkContext>::impls_for_trait
55: chalk_solve::clauses::program_clauses_for_goal
56: <chalk_recursive::recursive::Solver as chalk_recursive::solve::SolveDatabase>::solve_goal
57: <chalk_recursive::recursive::RecursiveSolver as chalk_solve::solve::Solver>::solve_limited
58: hir_ty::traits::trait_solve_query
59: salsa::runtime::Runtime::execute_query_implementation
60: salsa::derived::slot::Slot<Q,MP>::read_upgrade
61: salsa::derived::slot::Slot<Q,MP>::read
62: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
63: salsa::QueryTable::get
64: ::trait_solve::__shim
65: ::trait_solve
66: hir_ty::autoderef::deref
67: <core::iter::sources::Successors<T,F> as core::iter::traits::iterator::Iterator>::next
68: core::iter::traits::iterator::Iterator::find_map
69: hir_ty::infer::expr::::infer_expr_inner
70: hir_ty::infer::expr::::infer_expr_coerce
71: hir_ty::infer::expr::::infer_block
72: hir_ty::infer::expr::::infer_expr_inner
73: hir_ty::infer::expr::::infer_expr_coerce
74: hir_ty::infer::infer_query
75: salsa::runtime::Runtime::execute_query_implementation
76: salsa::derived::slot::Slot<Q,MP>::read_upgrade
77: salsa::derived::slot::Slot<Q,MP>::read
78: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
79: ::infer_query::__shim
80: hir_ty::db::infer_wait
81: hir::source_analyzer::SourceAnalyzer::new_for_body
82: hir::semantics::SemanticsImpl::analyze_impl
83: hir::semantics::SemanticsImpl::descend_into_macros
84: ide::goto_definition::goto_definition
85: ide::Analysis::goto_definition
86: rust_analyzer::handlers::handle_goto_definition
87: ::call_box
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.
Panic context:

request: textDocument/codeAction CodeActionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
host: None,
port: None,
path: "/home/yuyang/lsp-server/src/lib.rs",
query: None,
fragment: None,
},
},
range: Range {
start: Position {
line: 32,
character: 40,
},
end: Position {
line: 32,
character: 40,
},
},
context: CodeActionContext {
diagnostics: [],
only: None,
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}

thread '' panicked at 'Internal error, cycle detected:

DatabaseKeyIndex { group_index: 7, query_index: 10, key_index: 488 }
DatabaseKeyIndex { group_index: 7, query_index: 8, key_index: 45 }
', /home/runner/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/salsa-0.16.0/src/lib.rs:490:48
stack backtrace:
0: rust_begin_unwind
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
1: std::panicking::begin_panic_fmt
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:437
2: salsa::QueryTable::get::{{closure}}
3: ::generic_defaults::__shim
4: ::generic_defaults
5: hir_ty::lower::substs_from_path_segment
6: hir_ty::lower::::from_resolved_path
7: hir_ty::lower::::from_path
8: hir_ty::lower::::from_type_bound
9: hir_ty::lower::::from_where_predicate
10: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next
11: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
12: hir_ty::lower::generic_predicates_for_param_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::read
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
17: ::generic_predicates_for_param::__shim
18: ::generic_predicates_for_param
19: hir_ty::utils::all_super_trait_refs
20: hir_ty::utils::associated_type_by_name_including_super_traits
21: hir_ty::lower::::from_partly_resolved_hir_path
22: hir_ty::lower::::from_hir_ext
23: core::ops::function::impls::<impl core::ops::function::FnOnce
for &mut F>::call_once
24: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
25: hir_ty::lower::generic_defaults_query
26: salsa::runtime::Runtime::execute_query_implementation
27: salsa::derived::slot::Slot<Q,MP>::read_upgrade
28: salsa::derived::slot::Slot<Q,MP>::read
29: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
30: ::generic_defaults::__shim
31: ::generic_defaults
32: hir_ty::lower::substs_from_path_segment
33: hir_ty::lower::::from_resolved_path
34: hir_ty::lower::::from_path
35: hir_ty::lower::impl_trait_query
36: salsa::runtime::Runtime::execute_query_implementation
37: salsa::derived::slot::Slot<Q,MP>::read_upgrade
38: salsa::derived::slot::Slot<Q,MP>::read
39: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
40: ::impl_trait::__shim
41: ::impl_trait
42: hir_ty::method_resolution::TraitImpls::trait_impls_in_crate_query
43: salsa::runtime::Runtime::execute_query_implementation
44: salsa::derived::slot::Slot<Q,MP>::read_upgrade
45: salsa::derived::slot::Slot<Q,MP>::read
46: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
47: ::trait_impls_in_crate::__shim
48: hir_ty::method_resolution::TraitImpls::trait_impls_in_deps_query
49: salsa::runtime::Runtime::execute_query_implementation
50: salsa::derived::slot::Slot<Q,MP>::read_upgrade
51: salsa::derived::slot::Slot<Q,MP>::read
52: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
53: ::trait_impls_in_deps::__shim
54: hir_ty::traits::chalk::<impl chalk_solve::RustIrDatabase<hir_ty::traits::chalk::interner::Interner> for hir_ty::traits::ChalkContext>::impls_for_trait
55: chalk_solve::clauses::program_clauses_for_goal
56: <chalk_recursive::recursive::Solver as chalk_recursive::solve::SolveDatabase>::solve_goal
57: <chalk_recursive::recursive::RecursiveSolver as chalk_solve::solve::Solver>::solve_limited
58: hir_ty::traits::trait_solve_query
59: salsa::runtime::Runtime::execute_query_implementation
60: salsa::derived::slot::Slot<Q,MP>::read_upgrade
61: salsa::derived::slot::Slot<Q,MP>::read
62: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
63: salsa::QueryTable::get
64: ::trait_solve::__shim
65: ::trait_solve
66: hir_ty::autoderef::deref
67: <core::iter::sources::Successors<T,F> as core::iter::traits::iterator::Iterator>::next
68: core::iter::traits::iterator::Iterator::find_map
69: hir_ty::infer::expr::::infer_expr_inner
70: hir_ty::infer::expr::::infer_expr_coerce
71: hir_ty::infer::expr::::infer_block
72: hir_ty::infer::expr::::infer_expr_inner
73: hir_ty::infer::expr::::infer_expr_coerce
74: hir_ty::infer::infer_query
75: salsa::runtime::Runtime::execute_query_implementation
76: salsa::derived::slot::Slot<Q,MP>::read_upgrade
77: salsa::derived::slot::Slot<Q,MP>::read
78: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
79: ::infer_query::__shim
80: hir_ty::db::infer_wait
81: hir_ty::diagnostics::validate_body
82: hir::code_model::Module::diagnostics
83: ide::diagnostics::diagnostics
84: ide::Analysis::diagnostics
85: rust_analyzer::handlers::handle_code_action
86: ::call_box
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.
Panic context:

request: textDocument/hover HoverParams {
text_document_position_params: TextDocumentPositionParams {
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
host: None,
port: None,
path: "/home/yuyang/lsp-server/src/lib.rs",
query: None,
fragment: None,
},
},
position: Position {
line: 34,
character: 38,
},
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
}

thread '' panicked at 'Internal error, cycle detected:

DatabaseKeyIndex { group_index: 7, query_index: 10, key_index: 488 }
DatabaseKeyIndex { group_index: 7, query_index: 8, key_index: 45 }
', /home/runner/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/salsa-0.16.0/src/lib.rs:490:48
stack backtrace:
0: rust_begin_unwind
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
1: std::panicking::begin_panic_fmt
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:437
2: salsa::QueryTable::get::{{closure}}
3: ::generic_defaults::__shim
4: ::generic_defaults
5: hir_ty::lower::substs_from_path_segment
6: hir_ty::lower::::from_resolved_path
7: hir_ty::lower::::from_path
8: hir_ty::lower::::from_type_bound
9: hir_ty::lower::::from_where_predicate
10: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next
11: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
12: hir_ty::lower::generic_predicates_for_param_query
13: salsa::runtime::Runtime::execute_query_implementation
14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
15: salsa::derived::slot::Slot<Q,MP>::read
16: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
17: ::generic_predicates_for_param::__shim
18: ::generic_predicates_for_param
19: hir_ty::utils::all_super_trait_refs
20: hir_ty::utils::associated_type_by_name_including_super_traits
21: hir_ty::lower::::from_partly_resolved_hir_path
22: hir_ty::lower::::from_hir_ext
23: core::ops::function::impls::<impl core::ops::function::FnOnce
for &mut F>::call_once
24: <alloc::vec::Vec as alloc::vec::SpecFromIter<T,I>>::from_iter
25: hir_ty::lower::generic_defaults_query
26: salsa::runtime::Runtime::execute_query_implementation
27: salsa::derived::slot::Slot<Q,MP>::read_upgrade
28: salsa::derived::slot::Slot<Q,MP>::read
29: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
30: ::generic_defaults::__shim
31: ::generic_defaults
32: hir_ty::lower::substs_from_path_segment
33: hir_ty::lower::::from_resolved_path
34: hir_ty::lower::::from_path
35: hir_ty::lower::impl_trait_query
36: salsa::runtime::Runtime::execute_query_implementation
37: salsa::derived::slot::Slot<Q,MP>::read_upgrade
38: salsa::derived::slot::Slot<Q,MP>::read
39: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
40: ::impl_trait::__shim
41: ::impl_trait
42: hir_ty::method_resolution::TraitImpls::trait_impls_in_crate_query
43: salsa::runtime::Runtime::execute_query_implementation
44: salsa::derived::slot::Slot<Q,MP>::read_upgrade
45: salsa::derived::slot::Slot<Q,MP>::read
46: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
47: ::trait_impls_in_crate::__shim
48: hir_ty::method_resolution::TraitImpls::trait_impls_in_deps_query
49: salsa::runtime::Runtime::execute_query_implementation
50: salsa::derived::slot::Slot<Q,MP>::read_upgrade
51: salsa::derived::slot::Slot<Q,MP>::read
52: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
53: ::trait_impls_in_deps::__shim
54: hir_ty::traits::chalk::<impl chalk_solve::RustIrDatabase<hir_ty::traits::chalk::interner::Interner> for hir_ty::traits::ChalkContext>::impls_for_trait
55: chalk_solve::clauses::program_clauses_for_goal
56: <chalk_recursive::recursive::Solver as chalk_recursive::solve::SolveDatabase>::solve_goal
57: <chalk_recursive::recursive::RecursiveSolver as chalk_solve::solve::Solver>::solve_limited
58: hir_ty::traits::trait_solve_query
59: salsa::runtime::Runtime::execute_query_implementation
60: salsa::derived::slot::Slot<Q,MP>::read_upgrade
61: salsa::derived::slot::Slot<Q,MP>::read
62: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
63: salsa::QueryTable::get
64: ::trait_solve::__shim
65: ::trait_solve
66: hir_ty::autoderef::deref
67: <core::iter::sources::Successors<T,F> as core::iter::traits::iterator::Iterator>::next
68: core::iter::traits::iterator::Iterator::find_map
69: hir_ty::infer::expr::::infer_expr_inner
70: hir_ty::infer::expr::::infer_expr_coerce
71: hir_ty::infer::expr::::infer_block
72: hir_ty::infer::expr::::infer_expr_inner
73: hir_ty::infer::expr::::infer_expr_coerce
74: hir_ty::infer::infer_query
75: salsa::runtime::Runtime::execute_query_implementation
76: salsa::derived::slot::Slot<Q,MP>::read_upgrade
77: salsa::derived::slot::Slot<Q,MP>::read
78: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::try_fetch
79: ::infer_query::__shim
80: hir_ty::db::infer_wait
81: hir::source_analyzer::SourceAnalyzer::new_for_body
82: hir::semantics::SemanticsImpl::analyze_impl
83: hir::semantics::SemanticsImpl::descend_into_macros
84: ide::hover::hover
85: std::panicking::try
86: ide::Analysis::hover
87: rust_analyzer::handlers::handle_hover
88: ::call_box
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

@fghzxm
Copy link

fghzxm commented Apr 29, 2021

This panic is reproduceable on my setup. It happens even on freshly cargo init'ed crates, with the same stacktrace.

It occurs on:

  • stable (0.2.574)
  • nightly (0.3.578, 49b219b10 2021-04-29 nightly)
  • the one installed by rustup component add rust-analyzer-preview (617535393 2021-04-28 dev).

Currently it's just impossible to do use any IDE feature (even hover) because of this crash. Parsing and diagnostics seem to work though.

EDIT: cargo: 1.53.0-nightly (4369396ce 2021-04-27)

@flodiebold
Copy link
Member

That sounds like it's caused by some new code in std. It might be helpful to try out older rust nightlies to see where it started.

@flodiebold flodiebold added Broken Window Bugs / technical debt to be addressed immediately S-actionable Someone could pick this issue up and work on it right now labels Apr 29, 2021
@flodiebold
Copy link
Member

rust-lang/rust@f97769a...ca075d2 shows a lot of changes. Maybe you could try some previous nightlies?

@fghzxm
Copy link

fghzxm commented Apr 29, 2021

@flodiebold My bad for not realizing that beta differs a lot from nightly 😅. But nightly-2021-04-27 does indeed work as well!

@flodiebold
Copy link
Member

Can you tell me the commit ID for that nightly? I'm not sure how to best find that out 😬

@fghzxm
Copy link

fghzxm commented Apr 29, 2021

It's 968425893.

@flodiebold
Copy link
Member

flodiebold commented Apr 29, 2021

Ok, that leaves a lot less: rust-lang/rust@9684258...ca075d2
So likely one of the changes in library/ in this diff is the culprit.

Edit: I suspect the generic default for the new FromResidual trait: rust-lang/rust@9684258...ca075d2#diff-55ca2bad04d574c9b9d2b0ea41dc8e3825970da85fd2fd853446e01715f1c024R219

@flodiebold
Copy link
Member

The next step would be to try to write a test in hir_ty with the FromResidual definition that reproduces the crash.

@flodiebold
Copy link
Member

Yep, this test panics:

#[test]
fn issue_8686() {
    check_infer(
        r#"
pub trait Try: FromResidual {
    type Output;
    type Residual;
}
pub trait FromResidual<R = <Self as Try>::Residual> {
     fn from_residual(residual: R) -> Self;
}

struct ControlFlow<B, C>;
impl<B, C> Try for ControlFlow {
    type Output = C;
    type Residual = ControlFlow<B, !>;
}
impl<B, C> FromResidual for ControlFlow {
    fn from_residual(r: ControlFlow<B, !>) -> Self { ControlFlow }
}

fn test() {
    ControlFlow::from_residual(ControlFlow::<u32, !>);
}
        "#,
        expect![[r#"
        "#]],
    );
}

flodiebold added a commit to flodiebold/rust-analyzer that referenced this issue Apr 29, 2021
flodiebold added a commit to flodiebold/rust-analyzer that referenced this issue Apr 29, 2021
This isn't actually how it works, you have to specify the exact trait
that has the associated type.

Fixes rust-lang#8686.
flodiebold added a commit to flodiebold/rust-analyzer that referenced this issue Apr 29, 2021
This isn't actually how it works, you have to specify the exact trait
that has the associated type.

Fixes rust-lang#8686.
@756445638
Copy link
Author

ok thanks

bors bot added a commit that referenced this issue Apr 30, 2021
8692: Fix panic caused by new Try trait definition r=flodiebold a=flodiebold

The new Try trait definition caused a query cycle for us. This adds recovery for that cycle, but also fixes the cause, which is that we went through the supertraits when resolving `<T as Trait>::Assoc`, which isn't actually necessary. I also rewrote `all_super_trait_refs` to an iterator before I realized what the actual problem was, so I kept that.

Fixes #8686.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Broken Window Bugs / technical debt to be addressed immediately S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants