rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
95.36k stars 12.29k forks source link

ICE: None in query system #108529

Closed matthiaskrgr closed 1 year ago

matthiaskrgr commented 1 year ago

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 - ::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 - >::call_once::{shim:vtable#0} 11: 0x7f5a3676de0d - as core::ops::function::Fn>::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 - ::find_cycle_in_stack:: 19: 0x7f5a391fabc0 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query:: 20: 0x7f5a391f9f12 - ::limits 21: 0x7f5a37b09164 - ::new 22: 0x7f5a3879ea74 - ::def_path_str_with_substs 23: 0x7f5a39fc5b87 - rustc_middle[601343bb8fcd9553]::query::descs::associated_item 24: 0x7f5a3a380284 - rustc_query_impl[786711e369e44d99]::plumbing::create_query_frame:: 25: 0x7f5a3a3eb746 - >::call_once 26: 0x7f5a3a280e20 - >::try_collect_active_jobs:: 27: 0x7f5a389bd0a2 - ::try_collect_active_jobs 28: 0x7f5a391fab78 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query:: 29: 0x7f5a391f9f12 - ::limits 30: 0x7f5a37b09164 - ::new 31: 0x7f5a3879ea74 - ::def_path_str_with_substs 32: 0x7f5a39fc2889 - rustc_middle[601343bb8fcd9553]::query::descs::hir_attrs 33: 0x7f5a3a37fd3b - rustc_query_impl[786711e369e44d99]::plumbing::create_query_frame:: 34: 0x7f5a3a3eeca3 - >::call_once 35: 0x7f5a3a280996 - >::try_collect_active_jobs:: 36: 0x7f5a389bd0a2 - ::try_collect_active_jobs 37: 0x7f5a391e8870 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query:: 38: 0x7f5a391e7fab - ::hir_crate 39: 0x7f5a38307d39 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query:: 40: 0x7f5a383065cf - ::attrs 41: 0x7f5a39037254 - >::call_once 42: 0x7f5a391fa2e1 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query:: 43: 0x7f5a391f9f12 - ::limits 44: 0x7f5a37b09164 - ::new 45: 0x7f5a3879ea74 - ::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:: 48: 0x7f5a3a3ee1a3 - >::call_once 49: 0x7f5a3a280c96 - >::try_collect_active_jobs:: 50: 0x7f5a389bd0a2 - ::try_collect_active_jobs 51: 0x7f5a39221161 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query:: 52: 0x7f5a39220a5b - ::resolver_for_lowering 53: 0x7f5a39120b5c - rustc_interface[486a19237c59a8ab]::passes::output_filenames 54: 0x7f5a392032f8 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query:: 55: 0x7f5a39202feb - ::output_filenames 56: 0x7f5a3858ece1 - rustc_ast_lowering[61f4ef21b9edeeb8]::lower_to_hir 57: 0x7f5a391e82ab - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query:: 58: 0x7f5a391e7fab - ::hir_crate 59: 0x7f5a37b2c5ad - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query:: 60: 0x7f5a37b29639 - ::local_def_id_to_hir_id 61: 0x7f5a38333ef2 - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query:: 62: 0x7f5a38333730 - ::associated_item 63: 0x7f5a390c3127 - ::def_kind_descr 64: 0x7f5a37dac791 - ::resolve_path_with_ribs 65: 0x7f5a38acbeff - ::finalize_import 66: 0x7f5a38acad0d - ::finalize_imports 67: 0x7f5a38ab378a - ::time::<(), ::resolve_crate::{closure#0}> 68: 0x7f5a38aada57 - rustc_interface[486a19237c59a8ab]::passes::resolver_for_lowering 69: 0x7f5a39220d3a - rustc_query_system[a9f9b0e7f09240f6]::query::plumbing::try_execute_query:: 70: 0x7f5a39220a5b - ::resolver_for_lowering 71: 0x7f5a39043b61 - ::enter::)>> 72: 0x7f5a38c05c72 - rustc_span[e65e5540b5429333]::with_source_map::, rustc_interface[486a19237c59a8ab]::interface::run_compiler, rustc_driver_impl[bc26c1ad442828c6]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 73: 0x7f5a38bfd42c - std[5dcec7dd1f4ae3bb]::sys_common::backtrace::__rust_begin_short_backtrace::, 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 - <::spawn_unchecked_, 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 - as core::ops::function::FnOnce>::call_once::hdc0d6d4b555c5629 at /rustc/49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39/library/alloc/src/boxed.rs:1988:9 76: 0x7f5a36777c93 - as core::ops::function::FnOnce>::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 - 79: 0x7f5a36589d90 - 80: 0x0 - 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 ```

clubby789 commented 1 year ago

searched nightlies: from nightly-2023-02-20 to nightly-2023-02-27 regressed nightly: nightly-2023-02-24 searched commit range: https://github.com/rust-lang/rust/compare/fdbc4329cb781c7768ffa6d76c8fa2d032d3fe20...07c993eba8b76eae497e98433ae075b00f01be10 regressed commit: https://github.com/rust-lang/rust/commit/0978711950b77582e4f8f334f6e9848d48ab7790 -> #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 https://github.com/rust-lang/rust/blob/7d782b7ff4d57170e110211565209ecc5bbb3907/compiler/rustc_query_system/src/query/plumbing.rs#L214-L218 causes a panic in locking the active jobs