Repository: rust
Issue: ICE: Unwrap none in `rustc_query_system/src/query/plumbing.rs`
Labels: I-ICE,T-compiler,C-bug,A-query-system

This ICE occurred on commit [`8986ab1`][1] in a CI for a PR to Tokio, during cross-compilation to i686-unknown-linux-gnu. Rerunning the CI step made it complete successfully, so I am unable to reproduce the issue. The other CI steps for other targets also succeeded.

[1]: https://github.com/tokio-rs/tokio/pull/5569/commits/8986ab167ca38934f35f0c8f788c4ee3b315942c

### Meta

`rustc --version --verbose`:
```
rustc 1.68.2 (9eb3afe9e 2023-03-27)
binary: rustc
commit-hash: 9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0
commit-date: 2023-03-27
host: x86_64-unknown-linux-gnu
release: 1.68.2
LLVM version: 15.0.6
```

### Error output

```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/compiler/rustc_query_system/src/query/plumbing.rs:269:41
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/panicking.rs:64:14
   2: core::panicking::panic
             at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/panicking.rs:114:5
   3: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::evaluate_obligation, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
   4: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_must_hold_modulo_regions
   5: rustc_ty_utils::common_traits::is_copy_raw
   6: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::is_copy_raw, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
   7: rustc_ty_utils::needs_drop::needs_drop_raw
   8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::needs_drop_raw, rustc_query_impl::plumbing::QueryCtxt>
   9: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::needs_drop_raw
  10: rustc_mir_dataflow::drop_flag_effects::on_all_children_bits::on_all_children_bits::<rustc_mir_dataflow::drop_flag_effects::on_all_drop_children_bits<rustc_mir_transform::elaborate_drops::find_dead_unwinds::{closure#0}>::{closure#0}>
  11: <rustc_mir_transform::elaborate_drops::ElaborateDrops as rustc_middle::mir::MirPass>::run_pass
  12: rustc_mir_transform::run_analysis_to_runtime_passes
  13: rustc_mir_transform::mir_drops_elaborated_and_const_checked
  14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_drops_elaborated_and_const_checked, rustc_query_impl::plumbing::QueryCtxt>
  15: rustc_mir_transform::optimized_mir
  16: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::optimized_mir, rustc_query_impl::plumbing::QueryCtxt>
  17: rustc_monomorphize::collector::collect_neighbours
  18: rustc_monomorphize::collector::collect_items_rec
  19: rustc_monomorphize::collector::collect_items_rec
  20: rustc_monomorphize::collector::collect_items_rec
  21: <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}>
  22: rustc_monomorphize::collector::collect_crate_mono_items
  23: rustc_monomorphize::partitioning::collect_and_partition_mono_items
  24: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::collect_and_partition_mono_items, rustc_query_impl::plumbing::QueryCtxt>
  25: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items
  26: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
  27: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  28: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  29: rustc_interface::passes::start_codegen
  30: <rustc_interface::queries::Queries>::ongoing_codegen
  31: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  32: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.68.2 (9eb3afe9e 2023-03-27) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [is_copy_raw] computing whether `tokio::io::seek::Seek<'_, tokio::io::util::buf_reader::BufReader<test_buffered_reader_seek_underflow::{closure#0}::PositionReader>>` is `Copy`
#1 [needs_drop_raw] computing whether `[async block@tokio/tests/io_buf_reader.rs:133:1: 133:15]` needs drop
#2 [mir_drops_elaborated_and_const_checked] elaborating drops for `test_buffered_reader_seek_underflow`
#3 [optimized_mir] optimizing MIR for `test_buffered_reader_seek_underflow`
#4 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `tokio`
```