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

ICE: None in query system #108529

Closed
matthiaskrgr opened this issue Feb 27, 2023 · 1 comment · Fixed by #108533
Closed

ICE: None in query system #108529

matthiaskrgr opened this issue Feb 27, 2023 · 1 comment · Fixed by #108533
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

use f::f::f;

trait f {
    extern "C" fn f();
}

Meta

rustc --version --verbose:

rustc 1.69.0-nightly (49b9cc513 2023-02-27)
binary: rustc
commit-hash: 49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39
commit-date: 2023-02-27
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Error output


Backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/compiler/rustc_query_system/src/query/job.rs:141:44
stack backtrace:
   0:     0x7f5a3676aa8a - std::backtrace_rs::backtrace::libunwind::trace::h085f5e8bde6e3577
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f5a3676aa8a - std::backtrace_rs::backtrace::trace_unsynchronized::h4ed531a87f9912a7
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f5a3676aa8a - std::sys_common::backtrace::_print_fmt::h1861e29124570715
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f5a3676aa8a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h286ce0389355c587
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f5a367caa0e - core::fmt::write::hb04301bc0f21c72b
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/core/src/fmt/mod.rs:1232:17
   5:     0x7f5a3675af35 - std::io::Write::write_fmt::he4a82454fad22b4d
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/io/mod.rs:1684:15
   6:     0x7f5a3676a855 - std::sys_common::backtrace::_print::h447623ee9b9917a0
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f5a3676a855 - std::sys_common::backtrace::print::h9746242f5881991e
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f5a3676d5cf - std::panicking::default_hook::{{closure}}::h3ad85e7d34de3795
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/panicking.rs:271:22
   9:     0x7f5a3676d30b - std::panicking::default_hook::h4c94fd70502c5220
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/panicking.rs:290:9
  10:     0x7f5a399d4c15 - <rustc_driver_impl[bc26c1ad442828c6]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[c9c707274de8040a]::ops::function::FnOnce<(&core[c9c707274de8040a]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f5a3676de0d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h9293b8b96cbbfd0b
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/alloc/src/boxed.rs:2002:9
  12:     0x7f5a3676de0d - std::panicking::rust_panic_with_hook::h4513edbce5c5f9f5
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/panicking.rs:696:13
  13:     0x7f5a3676db42 - std::panicking::begin_panic_handler::{{closure}}::h60a484cf41c4fd55
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/panicking.rs:581:13
  14:     0x7f5a3676aef6 - std::sys_common::backtrace::__rust_end_short_backtrace::h9b240e87ae41d420
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/sys_common/backtrace.rs:137:18
  15:     0x7f5a3676d892 - rust_begin_unwind
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/panicking.rs:579:5
  16:     0x7f5a367c73b3 - core::panicking::panic_fmt::hc10bf22101c6f915
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/core/src/panicking.rs:64:14
  17:     0x7f5a367c744d - core::panicking::panic::h416eb2311158f838
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/core/src/panicking.rs:114:5
  18:     0x7f5a3925b455 - <rustc_query_system[a9f9b0e7f09240f6]::query::job::QueryJobId>::find_cycle_in_stack::<rustc_middle[601343bb8fcd9553]::dep_graph::dep_node::DepKind>
  19:     0x7f5a391fabc0 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query::<rustc_query_impl[786711e369e44d99]::queries::limits, rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  20:     0x7f5a391f9f12 - <rustc_query_impl[786711e369e44d99]::Queries as rustc_middle[601343bb8fcd9553]::ty::query::QueryEngine>::limits
  21:     0x7f5a37b09164 - <rustc_middle[601343bb8fcd9553]::ty::print::pretty::FmtPrinter>::new
  22:     0x7f5a3879ea74 - <rustc_middle[601343bb8fcd9553]::ty::context::TyCtxt>::def_path_str_with_substs
  23:     0x7f5a39fc5b87 - rustc_middle[601343bb8fcd9553]::query::descs::associated_item
  24:     0x7f5a3a380284 - rustc_query_impl[786711e369e44d99]::plumbing::create_query_frame::<rustc_span[e65e5540b5429333]::def_id::DefId>
  25:     0x7f5a3a3eb746 - <rustc_query_impl[786711e369e44d99]::query_structs::associated_item::{closure#0}::{closure#0} as core[c9c707274de8040a]::ops::function::FnOnce<(rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt, rustc_span[e65e5540b5429333]::def_id::DefId)>>::call_once
  26:     0x7f5a3a280e20 - <rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::QueryState<rustc_span[e65e5540b5429333]::def_id::DefId, rustc_middle[601343bb8fcd9553]::dep_graph::dep_node::DepKind>>::try_collect_active_jobs::<rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  27:     0x7f5a389bd0a2 - <rustc_query_impl[786711e369e44d99]::Queries>::try_collect_active_jobs
  28:     0x7f5a391fab78 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query::<rustc_query_impl[786711e369e44d99]::queries::limits, rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  29:     0x7f5a391f9f12 - <rustc_query_impl[786711e369e44d99]::Queries as rustc_middle[601343bb8fcd9553]::ty::query::QueryEngine>::limits
  30:     0x7f5a37b09164 - <rustc_middle[601343bb8fcd9553]::ty::print::pretty::FmtPrinter>::new
  31:     0x7f5a3879ea74 - <rustc_middle[601343bb8fcd9553]::ty::context::TyCtxt>::def_path_str_with_substs
  32:     0x7f5a39fc2889 - rustc_middle[601343bb8fcd9553]::query::descs::hir_attrs
  33:     0x7f5a3a37fd3b - rustc_query_impl[786711e369e44d99]::plumbing::create_query_frame::<rustc_span[e65e5540b5429333]::def_id::LocalDefId>
  34:     0x7f5a3a3eeca3 - <rustc_query_impl[786711e369e44d99]::query_structs::hir_attrs::{closure#0}::{closure#0} as core[c9c707274de8040a]::ops::function::FnOnce<(rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt, rustc_hir[14f82f6595ad0848]::hir_id::OwnerId)>>::call_once
  35:     0x7f5a3a280996 - <rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::QueryState<rustc_hir[14f82f6595ad0848]::hir_id::OwnerId, rustc_middle[601343bb8fcd9553]::dep_graph::dep_node::DepKind>>::try_collect_active_jobs::<rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  36:     0x7f5a389bd0a2 - <rustc_query_impl[786711e369e44d99]::Queries>::try_collect_active_jobs
  37:     0x7f5a391e8870 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query::<rustc_query_impl[786711e369e44d99]::queries::hir_crate, rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  38:     0x7f5a391e7fab - <rustc_query_impl[786711e369e44d99]::Queries as rustc_middle[601343bb8fcd9553]::ty::query::QueryEngine>::hir_crate
  39:     0x7f5a38307d39 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query::<rustc_query_impl[786711e369e44d99]::queries::hir_attrs, rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  40:     0x7f5a383065cf - <rustc_middle[601343bb8fcd9553]::hir::map::Map>::attrs
  41:     0x7f5a39037254 - <rustc_middle[601343bb8fcd9553]::middle::limits::provide::{closure#0} as core[c9c707274de8040a]::ops::function::FnOnce<(rustc_middle[601343bb8fcd9553]::ty::context::TyCtxt, ())>>::call_once
  42:     0x7f5a391fa2e1 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query::<rustc_query_impl[786711e369e44d99]::queries::limits, rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  43:     0x7f5a391f9f12 - <rustc_query_impl[786711e369e44d99]::Queries as rustc_middle[601343bb8fcd9553]::ty::query::QueryEngine>::limits
  44:     0x7f5a37b09164 - <rustc_middle[601343bb8fcd9553]::ty::print::pretty::FmtPrinter>::new
  45:     0x7f5a3879ea74 - <rustc_middle[601343bb8fcd9553]::ty::context::TyCtxt>::def_path_str_with_substs
  46:     0x7f5a39fc2619 - rustc_middle[601343bb8fcd9553]::query::descs::opt_local_def_id_to_hir_id
  47:     0x7f5a3a37fd3b - rustc_query_impl[786711e369e44d99]::plumbing::create_query_frame::<rustc_span[e65e5540b5429333]::def_id::LocalDefId>
  48:     0x7f5a3a3ee1a3 - <rustc_query_impl[786711e369e44d99]::query_structs::opt_local_def_id_to_hir_id::{closure#0}::{closure#0} as core[c9c707274de8040a]::ops::function::FnOnce<(rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt, rustc_span[e65e5540b5429333]::def_id::LocalDefId)>>::call_once
  49:     0x7f5a3a280c96 - <rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::QueryState<rustc_span[e65e5540b5429333]::def_id::LocalDefId, rustc_middle[601343bb8fcd9553]::dep_graph::dep_node::DepKind>>::try_collect_active_jobs::<rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  50:     0x7f5a389bd0a2 - <rustc_query_impl[786711e369e44d99]::Queries>::try_collect_active_jobs
  51:     0x7f5a39221161 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query::<rustc_query_impl[786711e369e44d99]::queries::resolver_for_lowering, rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  52:     0x7f5a39220a5b - <rustc_query_impl[786711e369e44d99]::Queries as rustc_middle[601343bb8fcd9553]::ty::query::QueryEngine>::resolver_for_lowering
  53:     0x7f5a39120b5c - rustc_interface[486a19237c59a8ab]::passes::output_filenames
  54:     0x7f5a392032f8 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query::<rustc_query_impl[786711e369e44d99]::queries::output_filenames, rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  55:     0x7f5a39202feb - <rustc_query_impl[786711e369e44d99]::Queries as rustc_middle[601343bb8fcd9553]::ty::query::QueryEngine>::output_filenames
  56:     0x7f5a3858ece1 - rustc_ast_lowering[61f4ef21b9edeeb8]::lower_to_hir
  57:     0x7f5a391e82ab - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query::<rustc_query_impl[786711e369e44d99]::queries::hir_crate, rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  58:     0x7f5a391e7fab - <rustc_query_impl[786711e369e44d99]::Queries as rustc_middle[601343bb8fcd9553]::ty::query::QueryEngine>::hir_crate
  59:     0x7f5a37b2c5ad - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query::<rustc_query_impl[786711e369e44d99]::queries::opt_local_def_id_to_hir_id, rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  60:     0x7f5a37b29639 - <rustc_middle[601343bb8fcd9553]::ty::context::TyCtxt>::local_def_id_to_hir_id
  61:     0x7f5a38333ef2 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query::<rustc_query_impl[786711e369e44d99]::queries::associated_item, rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  62:     0x7f5a38333730 - <rustc_query_impl[786711e369e44d99]::Queries as rustc_middle[601343bb8fcd9553]::ty::query::QueryEngine>::associated_item
  63:     0x7f5a390c3127 - <rustc_middle[601343bb8fcd9553]::ty::context::TyCtxt>::def_kind_descr
  64:     0x7f5a37dac791 - <rustc_resolve[4def64703478b7d0]::Resolver>::resolve_path_with_ribs
  65:     0x7f5a38acbeff - <rustc_resolve[4def64703478b7d0]::Resolver>::finalize_import
  66:     0x7f5a38acad0d - <rustc_resolve[4def64703478b7d0]::Resolver>::finalize_imports
  67:     0x7f5a38ab378a - <rustc_session[ee9de636432887dd]::session::Session>::time::<(), <rustc_resolve[4def64703478b7d0]::Resolver>::resolve_crate::{closure#0}>
  68:     0x7f5a38aada57 - rustc_interface[486a19237c59a8ab]::passes::resolver_for_lowering
  69:     0x7f5a39220d3a - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query::<rustc_query_impl[786711e369e44d99]::queries::resolver_for_lowering, rustc_query_impl[786711e369e44d99]::plumbing::QueryCtxt>
  70:     0x7f5a39220a5b - <rustc_query_impl[786711e369e44d99]::Queries as rustc_middle[601343bb8fcd9553]::ty::query::QueryEngine>::resolver_for_lowering
  71:     0x7f5a39043b61 - <rustc_middle[601343bb8fcd9553]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[bc26c1ad442828c6]::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures[356579776fdb53f3]::steal::Steal<(rustc_middle[601343bb8fcd9553]::ty::ResolverAstLowering, alloc[e6d7d7193850919d]::rc::Rc<rustc_ast[750fab18a2b83b7f]::ast::Crate>)>>
  72:     0x7f5a38c05c72 - rustc_span[e65e5540b5429333]::with_source_map::<core[c9c707274de8040a]::result::Result<(), rustc_span[e65e5540b5429333]::ErrorGuaranteed>, rustc_interface[486a19237c59a8ab]::interface::run_compiler<core[c9c707274de8040a]::result::Result<(), rustc_span[e65e5540b5429333]::ErrorGuaranteed>, rustc_driver_impl[bc26c1ad442828c6]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  73:     0x7f5a38bfd42c - std[5dcec7dd1f4ae3bb]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[486a19237c59a8ab]::util::run_in_thread_pool_with_globals<rustc_interface[486a19237c59a8ab]::interface::run_compiler<core[c9c707274de8040a]::result::Result<(), rustc_span[e65e5540b5429333]::ErrorGuaranteed>, rustc_driver_impl[bc26c1ad442828c6]::run_compiler::{closure#1}>::{closure#0}, core[c9c707274de8040a]::result::Result<(), rustc_span[e65e5540b5429333]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c9c707274de8040a]::result::Result<(), rustc_span[e65e5540b5429333]::ErrorGuaranteed>>
  74:     0x7f5a38bfce5a - <<std[5dcec7dd1f4ae3bb]::thread::Builder>::spawn_unchecked_<rustc_interface[486a19237c59a8ab]::util::run_in_thread_pool_with_globals<rustc_interface[486a19237c59a8ab]::interface::run_compiler<core[c9c707274de8040a]::result::Result<(), rustc_span[e65e5540b5429333]::ErrorGuaranteed>, rustc_driver_impl[bc26c1ad442828c6]::run_compiler::{closure#1}>::{closure#0}, core[c9c707274de8040a]::result::Result<(), rustc_span[e65e5540b5429333]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c9c707274de8040a]::result::Result<(), rustc_span[e65e5540b5429333]::ErrorGuaranteed>>::{closure#1} as core[c9c707274de8040a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  75:     0x7f5a36777c93 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdc0d6d4b555c5629
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/alloc/src/boxed.rs:1988:9
  76:     0x7f5a36777c93 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf8b3e831d8db999a
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/alloc/src/boxed.rs:1988:9
  77:     0x7f5a36777c93 - std::sys::unix::thread::Thread::new::thread_start::h1220d52980a3afbf
                               at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/std/src/sys/unix/thread.rs:108:17
  78:     0x7f5a36507bb5 - <unknown>
  79:     0x7f5a36589d90 - <unknown>
  80:                0x0 - <unknown>

error: 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.69.0-nightly (49b9cc513 2023-02-27) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Feb 27, 2023
@clubby789
Copy link
Contributor

clubby789 commented Feb 27, 2023

searched nightlies: from nightly-2023-02-20 to nightly-2023-02-27
regressed nightly: nightly-2023-02-24
searched commit range: fdbc432...07c993e
regressed commit: 0978711 -> #108324

bisected with cargo-bisect-rustc v0.6.5

Host triple: x86_64-unknown-linux-gnu

cc @notriddle


tcx.local_def_id_to_hir_id seems to cause a cycle error, then this unwrap

return TryGetJob::Cycle(id.find_cycle_in_stack(
qcx.try_collect_active_jobs().unwrap(),
&current_job_id,
span,
));

causes a panic in locking the active jobs

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 27, 2023
…escr, r=compiler-errors

diagnostics: avoid querying `associated_item` in the resolver

Fixes rust-lang#108529

CC rust-lang#108324
@bors bors closed this as completed in f058bb0 Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants