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

Compiler panicked at 'called Option::unwrap() on a None value', compiler/rustc_middle/src/ty/query/mod.rs:235:5 #79891

Closed
ch-sc opened this issue Dec 10, 2020 · 2 comments
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

@ch-sc
Copy link

ch-sc commented Dec 10, 2020

I believe the compiler error started to occur after doing the following:
I added dependency lazy_static = "1.4.0" to cargo.toml and use its lazy_static macro in 2 files like shown in the code section of this bug report.

I can workaround the compiler error with cargo clean and then cargo build. Though, after a couple of builds the error re-emerges.

Code

lazy_static! {
    static ref COLOR_PATTERN: Regex = Regex::new(r"(\w* \w*) bag").unwrap();
    static ref QUANTITY_PATTERN: Regex = Regex::new(r"(\d*) (\w* \w*) bag").unwrap();
}

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (3d6705aa5 2020-12-07)
binary: rustc
commit-hash: 3d6705aa5abffe94c83bf09af8c3ba3c599845fc
commit-date: 2020-12-07
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly

Error output

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_middle/src/ty/query/mod.rs:235:5
Backtrace

stack backtrace:
   0:     0x7f3f8e0946a7 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f3f8e0946a7 - std::backtrace_rs::backtrace::trace_unsynchronized::h86340908ff889faa
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3f8e0946a7 - std::sys_common::backtrace::_print_fmt::h43f85f9b18230404
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f3f8e0946a7 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc132ae1a5b5aa7cd
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f3f8e10851c - core::fmt::write::hdf023a0036d2a25f
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/core/src/fmt/mod.rs:1078:17
   5:     0x7f3f8e086692 - std::io::Write::write_fmt::h8580846154bcb66a
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/io/mod.rs:1519:15
   6:     0x7f3f8e0983a5 - std::sys_common::backtrace::_print::h7ee55fed88d107a3
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f3f8e0983a5 - std::sys_common::backtrace::print::h54a7d3e52a524177
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f3f8e0983a5 - std::panicking::default_hook::{{closure}}::h60921e857bf55a40
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/panicking.rs:208:50
   9:     0x7f3f8e097efa - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/panicking.rs:225:9
  10:     0x7f3f8e94fa68 - rustc_driver::report_ice::hff78d76a39ffbb86
  11:     0x7f3f8e098ca6 - std::panicking::rust_panic_with_hook::h8d66bf42b407aaea
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/panicking.rs:595:17
  12:     0x7f3f8e098797 - std::panicking::begin_panic_handler::{{closure}}::hde71edcd925d0c5e
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/panicking.rs:495:13
  13:     0x7f3f8e094b6c - std::sys_common::backtrace::__rust_end_short_backtrace::h8a3c7d6cea578919
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f3f8e098729 - rust_begin_unwind
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/panicking.rs:493:5
  15:     0x7f3f8e104931 - core::panicking::panic_fmt::h20225113c4a2f8fd
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/core/src/panicking.rs:92:14
  16:     0x7f3f8e10487d - core::panicking::panic::h35b77276aa4b0c12
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/core/src/panicking.rs:50:5
  17:     0x7f3f9132f835 - rustc_middle::ty::query::try_load_from_on_disk_cache::hfa4775df5c5e0180
  18:     0x7f3f9060a3ca - rustc_query_system::dep_graph::graph::DepGraph<K>::exec_cache_promotions::h8caa69177622351e
  19:     0x7f3f90622c21 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::hab5675af7737b3e6
  20:     0x7f3f905c63bb - rustc_incremental::persist::save::save_in::h7f4f43356280dc0a
  21:     0x7f3f905c11d1 - rustc_data_structures::sync::join::h0120008f852881ce
  22:     0x7f3f90621cc2 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h2893ce60eec57bb6
  23:     0x7f3f905c58ef - rustc_incremental::persist::save::save_dep_graph::hffd3fb2ecc639a78
  24:     0x7f3f904a0daa - rustc_codegen_ssa::base::finalize_tcx::h68106e2729498b3e
  25:     0x7f3f8edbe457 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h067fffb3870bc5b0
  26:     0x7f3f8eb6db2e - rustc_session::utils::<impl rustc_session::session::Session>::time::had158f21ec5bf4d1
  27:     0x7f3f8ebb082c - rustc_interface::passes::QueryContext::enter::h40067ad7feabcbd0
  28:     0x7f3f8ec08c93 - rustc_interface::queries::Queries::ongoing_codegen::h4fc36fc05972247d
  29:     0x7f3f8e8f86e2 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hd899306a06575d0c
  30:     0x7f3f8e98b7f7 - rustc_span::with_source_map::ha4e07ff263d0dc1d
  31:     0x7f3f8e8f988b - rustc_interface::interface::create_compiler_and_run::h1d6d732867d1f489
  32:     0x7f3f8e9a5d60 - scoped_tls::ScopedKey<T>::set::h39c0aa543118d3f3
  33:     0x7f3f8e9ac546 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1e5aa72fb9cd6d86
  34:     0x7f3f8e90127a - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc793837e985b77ce
  35:     0x7f3f8e0a865a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/alloc/src/boxed.rs:1328:9
  36:     0x7f3f8e0a865a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/alloc/src/boxed.rs:1328:9
  37:     0x7f3f8e0a865a - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/library/std/src/sys/unix/thread.rs:71:17
  38:     0x7f3f8dfb5609 - start_thread
  39:     0x7f3f8dec9293 - clone
  40:                0x0 - <unknown>

@ch-sc ch-sc added 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. labels Dec 10, 2020
@niklaslong
Copy link

I have encountered this error as well. I'm not sure what code might have triggered it (it happened right after the addition of a couple dbg! calls, though this was likely coincidental).

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (3d6705aa5 2020-12-07)
binary: rustc
commit-hash: 3d6705aa5abffe94c83bf09af8c3ba3c599845fc
commit-date: 2020-12-07
host: x86_64-apple-darwin
release: 1.50.0-nightly

Error output

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_middle/src/ty/query/mod.rs:235:5
Backtrace with relevant notes
stack backtrace:
   0:        0x107dae1fc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hddf67b5e68ee5eac
   1:        0x107e1599d - core::fmt::write::hae6418d3f135b639
   2:        0x107d9fe16 - std::io::Write::write_fmt::h822c37b1fbb805d3
   3:        0x107db1e79 - std::panicking::default_hook::{{closure}}::hb8c76ec6b2b5fec2
   4:        0x107db1a00 - std::panicking::default_hook::h9520f36dd50be056
   5:        0x10eac7468 - rustc_driver::report_ice::hab08807b07bece61
   6:        0x107db265e - std::panicking::rust_panic_with_hook::hbb70e1d25c7381a9
   7:        0x107db2139 - std::panicking::begin_panic_handler::{{closure}}::hb72eee9aad2e147c
   8:        0x107dae6b8 - std::sys_common::backtrace::__rust_end_short_backtrace::h372ff87ecb2667f3
   9:        0x107db20ca - _rust_begin_unwind
  10:        0x107e3cc1f - core::panicking::panic_fmt::h261fd45d36f74dfa
  11:        0x107e3cb77 - core::panicking::panic::hee3a097dbdc988d8
  12:        0x112b8c396 - rustc_middle::ty::query::try_load_from_on_disk_cache::h79b5afe1c2e80cd7
  13:        0x1120a5284 - rustc_query_system::dep_graph::graph::DepGraph<K>::exec_cache_promotions::h59848ff5959f2b25
  14:        0x1120ba598 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h6b0f4f58f3fe4fa5
  15:        0x112074663 - rustc_incremental::persist::save::save_in::h95c4af985c810672
  16:        0x11207055f - rustc_data_structures::sync::join::h28cbe6f4856b759a
  17:        0x1120b9f9d - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h417a8e727abe81c6
  18:        0x112073707 - rustc_incremental::persist::save::save_dep_graph::h5168ffbb71fa5484
  19:        0x111f90893 - rustc_codegen_ssa::base::finalize_tcx::h27af4387e3fad8ad
  20:        0x10ee782c0 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h672987f7a5956f16
  21:        0x10ec89dad - rustc_session::utils::<impl rustc_session::session::Session>::time::hdde8570199d8b0d3
  22:        0x10ecc18e2 - rustc_interface::passes::QueryContext::enter::hd55f5917ee1869a7
  23:        0x10ed07690 - rustc_interface::queries::Queries::ongoing_codegen::hd9e56cbce1d99cdb
  24:        0x10ea79b6f - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hb3cbdf40d2d583ab
  25:        0x10eaf73de - rustc_span::with_source_map::h4f73b4651f1d8670
  26:        0x10ea7aae4 - rustc_interface::interface::create_compiler_and_run::ha35d2af54e9355e8
  27:        0x10eb0d749 - scoped_tls::ScopedKey<T>::set::h8cb1fe74bd062a4c
  28:        0x10eb13b91 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8e2469a9116ebf76
  29:        0x10ea821c9 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hfc39034b1b021f49
  30:        0x107dbefdd - std::sys::unix::thread::Thread::new::thread_start::h93dd3097fa4fa219
  31:     0x7fff6d53a109 - __pthread_start

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: rustc 1.50.0-nightly (3d6705aa5 2020-12-07) running on x86_64-apple-darwin

note: compiler flags: -C linker-plugin-lto -C debuginfo=2 -C incremental -C target-cpu=native --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

@jyn514
Copy link
Member

jyn514 commented Dec 10, 2020

Duplicate of #79661, this should be fixed on the latest nightly.

@jyn514 jyn514 closed this as completed Dec 10, 2020
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

No branches or pull requests

3 participants