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

Unexpected None, no reproduction #79842

Closed
ghost opened this issue Dec 8, 2020 · 5 comments
Closed

Unexpected None, no reproduction #79842

ghost opened this issue Dec 8, 2020 · 5 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

@ghost
Copy link

ghost commented Dec 8, 2020

When this ICE happened, I tried to create a minimal reproduction right away; this was apparently a mistake, as after a few changes to my code, the crash vanished and I couldn't get it to come back. I'm reporting this anyway with the hope that someone might be able to work backwards from the point of the crash and figure out where the bad None is coming from.

Code

While I was trying to figure out which part of my code was triggering this issue by deleting various pieces and recompiling, it disappeared and refused to come back even after restoring my code back to where it was when the crash happened. I therefore have been unable to reproduce the issue with any specific code. I understand that this probably makes this issue very difficult to investigate.

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-musl
release: 1.50.0-nightly

My build situation is very weird. The code being compiled is no_std, rustc is given -Z pre-link-args=-nostartfiles, and cargo is given -Z build-std=core,alloc --target x86_64-unknown-linux-gnu. There are probably other weird things around that I missed when I dug through my build setup and Cargo.tomls.

Error output

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_middle/src/ty/query/mod.rs:235:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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.50.0-nightly (3d6705aa5 2020-12-07) running on x86_64-unknown-linux-musl

note: compiler flags: -Z pre-link-args=-nostartfiles -Z unstable-options -C panic=abort -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
end of query stack
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `LLVMing`,
 right: `Codegenning`', /rustc/3d6705aa5abffe94c83bf09af8c3ba3c599845fc/compiler/rustc_codegen_ssa/src/back/write.rs:1425:21

error: internal compiler error: unexpected panic

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.50.0-nightly (3d6705aa5 2020-12-07) running on x86_64-unknown-linux-musl

note: compiler flags: -Z pre-link-args=-nostartfiles -Z unstable-options -C panic=abort -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
end of query stack

I tried to create a minimal reproduction before I ran with RUST_BACKTRACE, so unfortunately I don't have a backtrace to report. Again, I know this makes this very hard to investigate.

@ghost ghost 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 8, 2020
@RustyYato
Copy link
Contributor

RustyYato commented Dec 8, 2020

I ran into exactly the same error in my crate contextual, on the ICE-2 branch linked below (I have all build artifacts, just in case this was a caching issue, like #79835, but if that's not the case I'll be removing the target dir)

https://github.com/RustyYato/contextual/tree/ICE-2

edit: (I've updated the mvp from the ICE branch to the ICE-2 branch)

I'll try and get that as minimal as I can get it

$ 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-pc-windows-msvc
release: 1.50.0-nightly
Backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler\rustc_middle\src\ty\query\mod.rs:235:5
stack backtrace:
   0:     0x7ffbcd57b865 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h106ca6f8fb6a294d
   1:     0x7ffbcd5a727b - core::fmt::write::h6390b994d95aebdb
   2:     0x7ffbcd56cefd - <std::io::IoSlice as core::fmt::Debug>::fmt::hd713332ae62141f3
   3:     0x7ffbcd57fbdd - std::panicking::take_hook::h78f8a454f3a4df82
   4:     0x7ffbcd57f66a - std::panicking::take_hook::h78f8a454f3a4df82
   5:     0x7ffba5661127 - rustc_driver::report_ice::h4bc3647b6f621de8
   6:     0x7ffbcd580730 - std::panicking::rust_panic_with_hook::h931fd6f26be82856
   7:     0x7ffbcd5801d3 - rust_begin_unwind
   8:     0x7ffbcd57c20f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h106ca6f8fb6a294d
   9:     0x7ffbcd580159 - rust_begin_unwind
  10:     0x7ffbcd5a32f0 - core::panicking::panic_fmt::h45da916c710b88f7
  11:     0x7ffbcd5a323c - core::panicking::panic::h3a7a516f2be28c18
  12:     0x7ffba9902a70 - rustc_middle::ty::query::force_from_dep_node::h841e1a791cab1f4a
  13:     0x7ffba8d0a65a - <rustc_incremental::assert_dep_graph::GraphvizDepGraph as rustc_graphviz::Labeller>::node_label::h0377fe93b350976d
  14:     0x7ffba8d21410 - rustc_incremental::persist::fs::garbage_collect_session_directories::h8752c03e5176082c
  15:     0x7ffba8cd84d9 - rustc_incremental::persist::save::save_work_product_index::h9f355c816532590a
  16:     0x7ffba8cd4634 - punycode::encode::h3996edd3fcfd4e50
  17:     0x7ffba8d20ca9 - rustc_incremental::persist::fs::garbage_collect_session_directories::h8752c03e5176082c
  18:     0x7ffba8cd7715 - rustc_incremental::persist::save::save_dep_graph::h454bb9997b91eed7
  19:     0x7ffba8bf5790 - rustc_codegen_ssa::base::finalize_tcx::h0bd1f35d020d2bd3
  20:     0x7ffba5a74565 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h409f60e0ae4aaf13
  21:     0x7ffba5858ede - rustc_interface::interface::parse_cfgspecs::he4e421c50de55949
  22:     0x7ffba588d3da - rustc_interface::passes::BoxedResolver::to_resolver_outputs::hb096f93f8cf6df4c
  23:     0x7ffba58d5a46 - rustc_interface::queries::Queries::ongoing_codegen::ha9e2915cfb307d3a
  24:     0x7ffba5608b74 - <rustc_codegen_ssa::back::linker::MsvcLinker as rustc_codegen_ssa::back::linker::Linker>::no_crt_objects::h47dd01e667a15f55
  25:     0x7ffba5699aac - <rustc_driver::args::Error as core::fmt::Debug>::fmt::hb838ed2d57a61e3c
  26:     0x7ffba5609bfc - <rustc_codegen_ssa::back::linker::MsvcLinker as rustc_codegen_ssa::back::linker::Linker>::no_crt_objects::h47dd01e667a15f55
  27:     0x7ffba56b0f84 - <rustc_driver::args::Error as core::fmt::Debug>::fmt::hb838ed2d57a61e3c
  28:     0x7ffba56b8270 - rustc_ast::util::parser::prec_let_scrutinee_needs_par::h0da38a96661182e5
  29:     0x7ffba5612a3d - <rustc_codegen_ssa::back::linker::MsvcLinker as rustc_codegen_ssa::back::linker::Linker>::no_crt_objects::h47dd01e667a15f55
  30:     0x7ffbcd58f4f7 - std::sys::windows::thread::Thread::new::h05d768f6146b61f1
  31:     0x7ffc07127034 - BaseThreadInitThunk
  32:     0x7ffc07e9cec1 - RtlUserThreadStart

error: internal compiler error: unexpected panic

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.50.0-nightly (3d6705aa5 2020-12-07) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
end of query stack
warning: 2 warnings emitted

@ghost
Copy link
Author

ghost commented Dec 8, 2020

I'm pretty sure it's a cache issue; I took a look at the error location and it's in a function called try_load_from_on_disk_cache.

@ghost
Copy link
Author

ghost commented Dec 8, 2020

Having looked a little deeper, this is probably related to #79835.

@RustyYato
Copy link
Contributor

Yeah, I've seen ICEs like this previously, which is why I saved all the build artifacts. That way I always have a repro

@camelid
Copy link
Member

camelid commented Dec 8, 2020

Looks like a duplicate of #79661.

@camelid camelid closed this as completed Dec 8, 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

2 participants