Repository: rust
Issue: compiler panicked when testing code
Labels: I-ICE,T-compiler,A-incr-comp,C-bug

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
-->

Just wanted to pass over this compiler error I ran into. The error went away after I cleaned (`cargo clean`) the project.

### Code

```Rust
N/A
```


### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
1.74.1
```

### Error output

```
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.74.1 (a28077b28 2023-12-04) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `<E as libra_storage::engine::Engine<'_>>::Transaction: core::marker::Sized`
#1 [is_sized_raw] computing whether `<E as libra_storage::engine::Engine<'_>>::Transaction` is `Sized`
#2 [mir_borrowck] borrow-checking `engine::kv::<impl at crates/db/src/engine/kv.rs:70:1: 70:72>::begin::{closure#0}`
end of query stack
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
thread 'rustc' panicked at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/compiler/rustc_query_system/src/dep_graph/graph.rs:1203:34:
attempted to read from stolen value: rustc_query_system::dep_graph::serialized::GraphEncoder<rustc_middle::dep_graph::DepsType>
stack backtrace:
   0:     0x7fd09371433c - std::backtrace_rs::backtrace::libunwind::trace::ha69d38c49f1bf263
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fd09371433c - std::backtrace_rs::backtrace::trace_unsynchronized::h93125d0b85fd543c
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd09371433c - std::sys_common::backtrace::_print_fmt::h8d65f438e8343444
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fd09371433c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h41751d2af6c8033a
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fd093779f9c - core::fmt::rt::Argument::fmt::h5db2f552d8a28f63
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/fmt/rt.rs:138:9
   5:     0x7fd093779f9c - core::fmt::write::h99465148a27e4883
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/fmt/mod.rs:1114:21
   6:     0x7fd0937070be - std::io::Write::write_fmt::hee8dfd57bd179ab2
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/io/mod.rs:1763:15
   7:     0x7fd093714124 - std::sys_common::backtrace::_print::h019a3cee3e814da4
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fd093714124 - std::sys_common::backtrace::print::h55694121c2ddf918
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fd093717003 - std::panicking::default_hook::{{closure}}::h29cbe3da3891b0b0
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:272:22
  10:     0x7fd093716d24 - std::panicking::default_hook::h881e76b2b8c74280
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:292:9
  11:     0x7fd0968c115f - std[afc0969a1e8d0069]::panicking::update_hook::<alloc[8b5739118bbd196f]::boxed::Box<rustc_driver_impl[edf179010582d687]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fd093717831 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hdafd71b4fdf5de15
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/alloc/src/boxed.rs:2021:9
  13:     0x7fd093717831 - std::panicking::rust_panic_with_hook::hcc36e25b6e33969c
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:735:13
  14:     0x7fd0937175b1 - std::panicking::begin_panic_handler::{{closure}}::ha415efb0f69f41f9
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:609:13
  15:     0x7fd093714866 - std::sys_common::backtrace::__rust_end_short_backtrace::h395fe90f99451e4e
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7fd093717302 - rust_begin_unwind
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:597:5
  17:     0x7fd093776625 - core::panicking::panic_fmt::h452a83e54ecd764e
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/panicking.rs:72:14
  18:     0x7fd0957e9dcb - <rustc_trait_selection[ed3448221a2282d1]::traits::select::SelectionContext>::evaluate_stack
  19:     0x7fd0957e37b2 - <rustc_query_system[38ffe91b6b23055d]::dep_graph::graph::DepGraph<rustc_middle[9d619393e8ff4f31]::dep_graph::DepsType>>::with_anon_task::<rustc_middle[9d619393e8ff4f31]::ty::context::TyCtxt, <rustc_trait_selection[ed3448221a2282d1]::traits::select::SelectionContext>::in_task<<rustc_trait_selection[ed3448221a2282d1]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively::{closure#0}::{closure#1}, core[e044522c7ef2d325]::result::Result<rustc_middle[9d619393e8ff4f31]::traits::select::EvaluationResult, rustc_middle[9d619393e8ff4f31]::traits::select::OverflowError>>::{closure#0}, core[e044522c7ef2d325]::result::Result<rustc_middle[9d619393e8ff4f31]::traits::select::EvaluationResult, rustc_middle[9d619393e8ff4f31]::traits::select::OverflowError>>
  20:     0x7fd0957dde58 - <rustc_trait_selection[ed3448221a2282d1]::traits::select::SelectionContext>::evaluate_predicate_recursively
  21:     0x7fd0957daca2 - rustc_traits[3ef5fd84f22ebd6b]::evaluate_obligation::evaluate_obligation
  22:     0x7fd0949b74ff - rustc_query_impl[2832811689f625f6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2832811689f625f6]::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9d619393e8ff4f31]::query::erase::Erased<[u8; 2usize]>>
  23:     0x7fd0949b74c1 - <rustc_query_impl[2832811689f625f6]::query_impl::evaluate_obligation::dynamic_query::{closure#2} as core[e044522c7ef2d325]::ops::function::FnOnce<(rustc_middle[9d619393e8ff4f31]::ty::context::TyCtxt, rustc_middle[9d619393e8ff4f31]::infer::canonical::Canonical<rustc_middle[9d619393e8ff4f31]::ty::ParamEnvAnd<rustc_middle[9d619393e8ff4f31]::ty::Predicate>>)>>::call_once
  24:     0x7fd0959b862b - rustc_query_system[38ffe91b6b23055d]::query::plumbing::try_execute_query::<rustc_query_impl[2832811689f625f6]::DynamicConfig<rustc_query_system[38ffe91b6b23055d]::query::caches::DefaultCache<rustc_middle[9d619393e8ff4f31]::infer::canonical::Canonical<rustc_middle[9d619393e8ff4f31]::ty::ParamEnvAnd<rustc_middle[9d619393e8ff4f31]::ty::Predicate>>, rustc_middle[9d619393e8ff4f31]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[2832811689f625f6]::plumbing::QueryCtxt, true>
  25:     0x7fd0959b707c - rustc_query_impl[2832811689f625f6]::query_impl::evaluate_obligation::get_query_incr::__rust_end_short_backtrace
  26:     0x7fd0957f78c3 - <rustc_infer[66eed79c2d45c887]::infer::InferCtxt as rustc_trait_selection[ed3448221a2282d1]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  27:     0x7fd095a12a3d - rustc_ty_utils[fa2bc75bbc854705]::common_traits::is_item_raw
  28:     0x7fd0949e0198 - rustc_query_impl[2832811689f625f6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2832811689f625f6]::query_impl::is_sized_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9d619393e8ff4f31]::query::erase::Erased<[u8; 1usize]>>
  29:     0x7fd0949e0161 - <rustc_query_impl[2832811689f625f6]::query_impl::is_sized_raw::dynamic_query::{closure#2} as core[e044522c7ef2d325]::ops::function::FnOnce<(rustc_middle[9d619393e8ff4f31]::ty::context::TyCtxt, rustc_middle[9d619393e8ff4f31]::ty::ParamEnvAnd<rustc_middle[9d619393e8ff4f31]::ty::Ty>)>>::call_once
  30:     0x7fd095b9cb4a - rustc_query_system[38ffe91b6b23055d]::query::plumbing::try_execute_query::<rustc_query_impl[2832811689f625f6]::DynamicConfig<rustc_query_system[38ffe91b6b23055d]::query::caches::DefaultCache<rustc_middle[9d619393e8ff4f31]::ty::ParamEnvAnd<rustc_middle[9d619393e8ff4f31]::ty::Ty>, rustc_middle[9d619393e8ff4f31]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2832811689f625f6]::plumbing::QueryCtxt, true>
  31:     0x7fd09621ccc9 - rustc_query_impl[2832811689f625f6]::query_impl::is_sized_raw::get_query_incr::__rust_end_short_backtrace
  32:     0x7fd095ab62e0 - <rustc_borrowck[16818dd8c444f33f]::type_check::TypeChecker>::typeck_mir
  33:     0x7fd0951b2ad5 - rustc_borrowck[16818dd8c444f33f]::type_check::type_check
  34:     0x7fd0951a676d - rustc_borrowck[16818dd8c444f33f]::nll::compute_regions
  35:     0x7fd09518bacc - rustc_borrowck[16818dd8c444f33f]::do_mir_borrowck
  36:     0x7fd095189e93 - rustc_borrowck[16818dd8c444f33f]::mir_borrowck
  37:     0x7fd094a1fcae - rustc_query_impl[2832811689f625f6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2832811689f625f6]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9d619393e8ff4f31]::query::erase::Erased<[u8; 8usize]>>
  38:     0x7fd094a1fc7e - <rustc_query_impl[2832811689f625f6]::query_impl::mir_borrowck::dynamic_query::{closure#2} as core[e044522c7ef2d325]::ops::function::FnOnce<(rustc_middle[9d619393e8ff4f31]::ty::context::TyCtxt, rustc_span[16fed22730bc75c0]::def_id::LocalDefId)>>::call_once
  39:     0x7fd095070397 - rustc_query_system[38ffe91b6b23055d]::query::plumbing::try_execute_query::<rustc_query_impl[2832811689f625f6]::DynamicConfig<rustc_query_system[38ffe91b6b23055d]::query::caches::VecCache<rustc_span[16fed22730bc75c0]::def_id::LocalDefId, rustc_middle[9d619393e8ff4f31]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[2832811689f625f6]::plumbing::QueryCtxt, true>
  40:     0x7fd0962163f8 - rustc_query_impl[2832811689f625f6]::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
  41:     0x7fd09624176f - <rustc_query_impl[2832811689f625f6]::query_impl::mir_borrowck::dynamic_query::{closure#1} as core[e044522c7ef2d325]::ops::function::FnOnce<(rustc_middle[9d619393e8ff4f31]::ty::context::TyCtxt, rustc_span[16fed22730bc75c0]::def_id::LocalDefId)>>::call_once
  42:     0x7fd0961f1d4a - <rustc_query_impl[2832811689f625f6]::plumbing::query_callback<rustc_query_impl[2832811689f625f6]::query_impl::mir_borrowck::QueryType>::{closure#1} as core[e044522c7ef2d325]::ops::function::FnOnce<(rustc_middle[9d619393e8ff4f31]::ty::context::TyCtxt, rustc_query_system[38ffe91b6b23055d]::dep_graph::dep_node::DepNode)>>::call_once
  43:     0x7fd095d5da06 - <rustc_query_system[38ffe91b6b23055d]::dep_graph::graph::DepGraph<rustc_middle[9d619393e8ff4f31]::dep_graph::DepsType>>::exec_cache_promotions::<rustc_middle[9d619393e8ff4f31]::ty::context::TyCtxt>
  44:     0x7fd095d5d588 - <rustc_middle[9d619393e8ff4f31]::query::on_disk_cache::OnDiskCache>::drop_serialized_data
  45:     0x7fd095d5d462 - <rustc_session[c6557f37e70f1e4]::session::Session>::time::<(), rustc_incremental[dd1ee73bff74c743]::persist::save::save_dep_graph::{closure#0}::{closure#3}::{closure#0}>
  46:     0x7fd095d5d20f - rustc_data_structures[96d7b101533d65de]::sync::parallel::disabled::join::<rustc_incremental[dd1ee73bff74c743]::persist::save::save_dep_graph::{closure#0}::{closure#2}, rustc_incremental[dd1ee73bff74c743]::persist::save::save_dep_graph::{closure#0}::{closure#3}, (), ()>
  47:     0x7fd095d5c76e - rustc_incremental[dd1ee73bff74c743]::persist::save::save_dep_graph
  48:     0x7fd095dfe8e3 - <rustc_session[c6557f37e70f1e4]::session::Session>::time::<(), <rustc_interface[250c7deb490bcc66]::interface::Compiler>::enter<rustc_driver_impl[edf179010582d687]::run_compiler::{closure#1}::{closure#2}, core[e044522c7ef2d325]::result::Result<core[e044522c7ef2d325]::option::Option<rustc_interface[250c7deb490bcc66]::queries::Linker>, rustc_span[16fed22730bc75c0]::ErrorGuaranteed>>::{closure#0}>
  49:     0x7fd095dfc686 - rustc_span[16fed22730bc75c0]::set_source_map::<core[e044522c7ef2d325]::result::Result<(), rustc_span[16fed22730bc75c0]::ErrorGuaranteed>, rustc_interface[250c7deb490bcc66]::interface::run_compiler<core[e044522c7ef2d325]::result::Result<(), rustc_span[16fed22730bc75c0]::ErrorGuaranteed>, rustc_driver_impl[edf179010582d687]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  50:     0x7fd095df6750 - std[afc0969a1e8d0069]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[250c7deb490bcc66]::util::run_in_thread_with_globals<rustc_interface[250c7deb490bcc66]::interface::run_compiler<core[e044522c7ef2d325]::result::Result<(), rustc_span[16fed22730bc75c0]::ErrorGuaranteed>, rustc_driver_impl[edf179010582d687]::run_compiler::{closure#1}>::{closure#0}, core[e044522c7ef2d325]::result::Result<(), rustc_span[16fed22730bc75c0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e044522c7ef2d325]::result::Result<(), rustc_span[16fed22730bc75c0]::ErrorGuaranteed>>
  51:     0x7fd095df605e - <<std[afc0969a1e8d0069]::thread::Builder>::spawn_unchecked_<rustc_interface[250c7deb490bcc66]::util::run_in_thread_with_globals<rustc_interface[250c7deb490bcc66]::interface::run_compiler<core[e044522c7ef2d325]::result::Result<(), rustc_span[16fed22730bc75c0]::ErrorGuaranteed>, rustc_driver_impl[edf179010582d687]::run_compiler::{closure#1}>::{closure#0}, core[e044522c7ef2d325]::result::Result<(), rustc_span[16fed22730bc75c0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e044522c7ef2d325]::result::Result<(), rustc_span[16fed22730bc75c0]::ErrorGuaranteed>>::{closure#1} as core[e044522c7ef2d325]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  52:     0x7fd093722395 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h51435299acd7166e
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/alloc/src/boxed.rs:2007:9
  53:     0x7fd093722395 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3f833c0a4926bdd4
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/alloc/src/boxed.rs:2007:9
  54:     0x7fd093722395 - std::sys::unix::thread::Thread::new::thread_start::h2c486d0230ab0d99
                               at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/sys/unix/thread.rs:108:17
  55:     0x7fd0935e6ea7 - start_thread
  56:     0x7fd093504a2f - clone
  57:                0x0 - <unknown>
```

</p>
</details>