Closed
Description
Code
I was experimenting with Bevy, and suddenly found rust-analyzer
has stopped me to show errors. It turned out that rustc
paniced on this function:
fn first_child<'w, 's, Q: WorldQuery, F: WorldQuery>(
query: Query<'w, 's, Q, F>,
) -> impl FnOnce(&Children) -> Result<QueryItem<Q>, QueryEntityError>
where
F::Fetch: FilterFetch,
{
move |children| children
.first()
.ok_or(QueryEntityError::NoSuchEntity)
.and_then(|child| query.get_mut(*child))
}
I added a commit with exact state of my project (it's pretty small ATM) where the compiler pianics gentoid/planetary-simulator-rs@720373d
Meta
rustc --version --verbose
:
rustc 1.59.0-nightly (e2116acae 2021-12-05)
binary: rustc
commit-hash: e2116acae59654bfab2a9729a024f3e2fd6d4b02
commit-date: 2021-12-05
host: x86_64-pc-windows-msvc
release: 1.59.0-nightly
LLVM version: 13.0.0
Error output
thread 'rustc' panicked at 'assertion failed: !value.has_escaping_bound_vars()', /rustc/e2116acae59654bfab2a9729a024f3e2fd6d4b02\compiler\rustc_middle\src\ty\sty.rs:1038:9
error: internal compiler error: unexpected panic
// backtrace extracted
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.59.0-nightly (e2116acae 2021-12-05) running on x86_64-pc-windows-msvc
note: compiler flags: -Z share-generics=n -C opt-level=1 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on -C linker=rust-lld.exe -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck] type-checking `ui::toggle_switch::first_child`
#1 [mir_built] building MIR for `ui::toggle_switch::first_child`
#2 [unsafety_check_result] unsafety-checking `ui::toggle_switch::first_child`
#3 [mir_const] processing MIR for `ui::toggle_switch::first_child`
#4 [mir_promoted] processing `ui::toggle_switch::first_child`
#5 [mir_borrowck] borrow-checking `ui::toggle_switch::first_child`
#6 [type_of] computing type of `ui::toggle_switch::first_child::{opaque#0}`
#7 [check_mod_item_types] checking item types in module `ui::toggle_switch`
#8 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `planetary-simulation-rs`
Backtrace
stack backtrace:
0: 0x7ffdd3b79c5f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc2aeea11bb07072e
1: 0x7ffdd3ba44fa - core::fmt::write::h8a2c40ddb66ccc71
2: 0x7ffdd3b6b9e8 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::hcdd1908fe2498bb7
3: 0x7ffdd3b7d1a6 - std::panicking::take_hook::hb82d3fa273181deb
4: 0x7ffdd3b7cc8c - std::panicking::take_hook::hb82d3fa273181deb
5: 0x7ffda2a9a7f5 - rand[4b787086680625d8]::rngs::adapter::reseeding::fork::register_fork_handler
6: 0x7ffdd3b7dab9 - std::panicking::rust_panic_with_hook::h8846bbc0e1c27093
7: 0x7ffdd3b7d52f - rust_begin_unwind
8: 0x7ffdd3b7a587 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc2aeea11bb07072e
9: 0x7ffdd3b7d4b9 - rust_begin_unwind
10: 0x7ffdd3bd8310 - core::panicking::panic_fmt::hc1b1ca620e7a2c9f
11: 0x7ffdd3bd825c - core::panicking::panic::hfef5cee9afdef02a
12: 0x7ffda6e2733f - <rustc_infer[bf6a5cf34576fc96]::infer::InferCtxt>::infer_projection
13: 0x7ffda6e92c62 - <rustc_infer[bf6a5cf34576fc96]::infer::glb::Glb as rustc_middle[63aa33dd3295c16a]::ty::relate::TypeRelation>::tys
14: 0x7ffda6e8a72c - <rustc_infer[bf6a5cf34576fc96]::infer::nll_relate::BoundRegionScope as core[3b5640218fb446b]::fmt::Debug>::fmt
15: 0x7ffda6e8957c - <rustc_infer[bf6a5cf34576fc96]::infer::nll_relate::BoundRegionScope as core[3b5640218fb446b]::fmt::Debug>::fmt
16: 0x7ffda6e3c4dd - <rustc_infer[bf6a5cf34576fc96]::infer::TyOrConstInferVar as core[3b5640218fb446b]::fmt::Debug>::fmt
17: 0x7ffda6e9ee98 - <rustc_infer[bf6a5cf34576fc96]::infer::opaque_types::Instantiator>::fold_opaque_ty
18: 0x7ffda562d116 - <rustc_typeck[ce8e60202e7a8568]::errors::AddressOfTemporaryTaken as rustc_session[e0903d0c66573cb2]::session::SessionDiagnostic>::into_diagnostic
19: 0x7ffda55ef757 - <rustc_typeck[ce8e60202e7a8568]::variance::terms::TermsContext as rustc_hir[695f4c026424ffe0]::itemlikevisit::ItemLikeVisitor>::visit_foreign_item
20: 0x7ffda5534665 - <rustc_typeck[ce8e60202e7a8568]::check::op::Op as core[3b5640218fb446b]::fmt::Debug>::fmt
21: 0x7ffda54c0bcc - rustc_typeck[ce8e60202e7a8568]::check::provide
22: 0x7ffda6233536 - <rustc_span[c5d9e30fa007120c]::def_id::DefIndex as rustc_query_impl[66d4c656b011426]::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
23: 0x7ffda62e8461 - rustc_query_impl[66d4c656b011426]::query_callbacks::diagnostic_hir_wf_check
24: 0x7ffda61d61c0 - <rustc_query_impl[66d4c656b011426]::queries::diagnostic_hir_wf_check as rustc_query_system[d5dc892f1d05674d]::query::config::QueryDescription<rustc_query_impl[66d4c656b011426]::plumbing::QueryCtxt>>::describe
25: 0x7ffda6041321 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
26: 0x7ffda6164ca5 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
27: 0x7ffda6fa931c - <rustc_middle[63aa33dd3295c16a]::ty::context::TyCtxt>::typeck_opt_const_arg
28: 0x7ffda5992b66 - <rustc_passes[e46a161e05503663]::region::Context as core[3b5640218fb446b]::fmt::Debug>::fmt
29: 0x7ffda6231adf - <rustc_span[c5d9e30fa007120c]::def_id::DefIndex as rustc_query_impl[66d4c656b011426]::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
30: 0x7ffda62db422 - rustc_query_impl[66d4c656b011426]::query_callbacks::diagnostic_hir_wf_check
31: 0x7ffda61d40a7 - <rustc_query_impl[66d4c656b011426]::queries::diagnostic_hir_wf_check as rustc_query_system[d5dc892f1d05674d]::query::config::QueryDescription<rustc_query_impl[66d4c656b011426]::plumbing::QueryCtxt>>::describe
32: 0x7ffda6014e88 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
33: 0x7ffda6167c6e - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
34: 0x7ffda51d5d0d - <rustc_mir_transform[df9c314920204a16]::check_unsafety::UnusedUnsafeVisitor as rustc_hir[695f4c026424ffe0]::intravisit::Visitor>::visit_block
35: 0x7ffda51d20e8 - <rustc_ast[e774d5699e415d73]::ast::Item<rustc_ast[e774d5699e415d73]::ast::ForeignItemKind> as rustc_ast[e774d5699e415d73]::ast_like::AstLike>::attrs
36: 0x7ffda6233536 - <rustc_span[c5d9e30fa007120c]::def_id::DefIndex as rustc_query_impl[66d4c656b011426]::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
37: 0x7ffda62e8461 - rustc_query_impl[66d4c656b011426]::query_callbacks::diagnostic_hir_wf_check
38: 0x7ffda61d6b30 - <rustc_query_impl[66d4c656b011426]::queries::diagnostic_hir_wf_check as rustc_query_system[d5dc892f1d05674d]::query::config::QueryDescription<rustc_query_impl[66d4c656b011426]::plumbing::QueryCtxt>>::describe
39: 0x7ffda6044061 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
40: 0x7ffda61417d5 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
41: 0x7ffda51e0ee2 - <rustc_mir_transform[df9c314920204a16]::mir_keys::GatherCtors as rustc_hir[695f4c026424ffe0]::intravisit::Visitor>::visit_variant_data
42: 0x7ffda6231adf - <rustc_span[c5d9e30fa007120c]::def_id::DefIndex as rustc_query_impl[66d4c656b011426]::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
43: 0x7ffda62db422 - rustc_query_impl[66d4c656b011426]::query_callbacks::diagnostic_hir_wf_check
44: 0x7ffda61d40a7 - <rustc_query_impl[66d4c656b011426]::queries::diagnostic_hir_wf_check as rustc_query_system[d5dc892f1d05674d]::query::config::QueryDescription<rustc_query_impl[66d4c656b011426]::plumbing::QueryCtxt>>::describe
45: 0x7ffda6014e88 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
46: 0x7ffda6167deb - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
47: 0x7ffda51e2039 - <rustc_mir_transform[df9c314920204a16]::mir_keys::GatherCtors as rustc_hir[695f4c026424ffe0]::intravisit::Visitor>::visit_variant_data
48: 0x7ffda6231c83 - <rustc_span[c5d9e30fa007120c]::def_id::DefIndex as rustc_query_impl[66d4c656b011426]::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
49: 0x7ffda62dbad6 - rustc_query_impl[66d4c656b011426]::query_callbacks::diagnostic_hir_wf_check
50: 0x7ffda61d9898 - <rustc_query_impl[66d4c656b011426]::queries::diagnostic_hir_wf_check as rustc_query_system[d5dc892f1d05674d]::query::config::QueryDescription<rustc_query_impl[66d4c656b011426]::plumbing::QueryCtxt>>::describe
51: 0x7ffda6122b69 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
52: 0x7ffda5bdedde - rustc_borrowck[2eb3a8cb6b41bf6b]::provide
53: 0x7ffda5bb0398 - <rustc_borrowck[2eb3a8cb6b41bf6b]::region_infer::values::RegionElement as core[3b5640218fb446b]::fmt::Debug>::fmt
54: 0x7ffda6233536 - <rustc_span[c5d9e30fa007120c]::def_id::DefIndex as rustc_query_impl[66d4c656b011426]::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
55: 0x7ffda62e8461 - rustc_query_impl[66d4c656b011426]::query_callbacks::diagnostic_hir_wf_check
56: 0x7ffda61d67c0 - <rustc_query_impl[66d4c656b011426]::queries::diagnostic_hir_wf_check as rustc_query_system[d5dc892f1d05674d]::query::config::QueryDescription<rustc_query_impl[66d4c656b011426]::plumbing::QueryCtxt>>::describe
57: 0x7ffda60429c1 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
58: 0x7ffda6122234 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
59: 0x7ffda55c7035 - <rustc_typeck[ce8e60202e7a8568]::coherence::inherent_impls_overlap::InherentOverlapChecker as rustc_hir[695f4c026424ffe0]::itemlikevisit::ItemLikeVisitor>::visit_item
60: 0x7ffda62344af - <rustc_span[c5d9e30fa007120c]::def_id::DefIndex as rustc_query_impl[66d4c656b011426]::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
61: 0x7ffda62f01d6 - rustc_query_impl[66d4c656b011426]::query_callbacks::diagnostic_hir_wf_check
62: 0x7ffda61d547b - <rustc_query_impl[66d4c656b011426]::queries::diagnostic_hir_wf_check as rustc_query_system[d5dc892f1d05674d]::query::config::QueryDescription<rustc_query_impl[66d4c656b011426]::plumbing::QueryCtxt>>::describe
63: 0x7ffda607c232 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
64: 0x7ffda6164fa8 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
65: 0x7ffda55da467 - rustc_typeck[ce8e60202e7a8568]::check::check::check_item_type
66: 0x7ffda55a3e28 - <rustc_typeck[ce8e60202e7a8568]::constrained_generic_params::Parameter as core[3b5640218fb446b]::fmt::Debug>::fmt
67: 0x7ffda55e1afd - rustc_typeck[ce8e60202e7a8568]::check::check::check_item_type
68: 0x7ffda6233b36 - <rustc_span[c5d9e30fa007120c]::def_id::DefIndex as rustc_query_impl[66d4c656b011426]::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
69: 0x7ffda62ebd21 - rustc_query_impl[66d4c656b011426]::query_callbacks::diagnostic_hir_wf_check
70: 0x7ffda61db027 - <rustc_query_impl[66d4c656b011426]::queries::diagnostic_hir_wf_check as rustc_query_system[d5dc892f1d05674d]::query::config::QueryDescription<rustc_query_impl[66d4c656b011426]::plumbing::QueryCtxt>>::describe
71: 0x7ffda6046d84 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
72: 0x7ffda613b1a2 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
73: 0x7ffda55a1c6d - <rustc_typeck[ce8e60202e7a8568]::constrained_generic_params::Parameter as core[3b5640218fb446b]::fmt::Debug>::fmt
74: 0x7ffda54e87eb - <rustc_typeck[ce8e60202e7a8568]::check::PlaceOp as core[3b5640218fb446b]::fmt::Debug>::fmt
75: 0x7ffda547e414 - rustc_typeck[ce8e60202e7a8568]::check_crate
76: 0x7ffda2bff9af - rustc_interface[1c6a2488f78f6a24]::passes::analysis
77: 0x7ffda6235a9b - <rustc_span[c5d9e30fa007120c]::def_id::DefIndex as rustc_query_impl[66d4c656b011426]::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string
78: 0x7ffda630843e - rustc_query_impl[66d4c656b011426]::query_callbacks::diagnostic_hir_wf_check
79: 0x7ffda61cc671 - <rustc_query_impl[66d4c656b011426]::queries::diagnostic_hir_wf_check as rustc_query_system[d5dc892f1d05674d]::query::config::QueryDescription<rustc_query_impl[66d4c656b011426]::plumbing::QueryCtxt>>::describe
80: 0x7ffda60c9bb9 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
81: 0x7ffda61650f2 - <rustc_mir_dataflow[60503fc7d90bc0c2]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[60503fc7d90bc0c2]::framework::AnalysisDomain>::initialize_start_block
83: 0x7ffda2ac03d5 - <rustc_middle[63aa33dd3295c16a]::ty::SymbolName as core[3b5640218fb446b]::fmt::Display>::fmt
84: 0x7ffda2ab1b25 - <chalk_engine[5e046f5921b469d8]::table::AnswerIndex>::increment
85: 0x7ffda2ac1781 - <rustc_middle[63aa33dd3295c16a]::ty::SymbolName as core[3b5640218fb446b]::fmt::Display>::fmt
86: 0x7ffda2abd773 - rustc_driver[dea966e5e189d317]::pretty::print_after_hir_lowering
87: 0x7ffda2b385f8 - <rustc_driver[dea966e5e189d317]::args::Error as core[3b5640218fb446b]::fmt::Debug>::fmt
88: 0x7ffdd3b8b18c - std::sys::windows::thread::Thread::new::h578a3ae84cde46a8
89: 0x7ffe3ca07034 - BaseThreadInitThunk
90: 0x7ffe3e602651 - RtlUserThreadStart