Description
I was cleaning up some code, attempting to replace an empty enum with the never type.
My changes encountered some sort of bug with the cache. Trying to create a minimal verifiable example fails entirely, probably related to this being a caching issue. Even if I copy my entire project directory without any other changes, the crash disappears.
The crash is reproducible in the original directory for now. With some guidance on what (cache)files I should look at, I think it should be possible to describe a way to reproduce this.
Another relevant bit of information might be that I updated my nightly toolchain about 30 minutes before. I did fix a number of clippy warnings with the new toolchain before the crash occurred, so maybe this is not part of the problem.
Code
Before:
pub enum NoFData {}
pub enum NoEData {}
pub enum JSendResponse<
SData,
FData=NoFData,
EData=NoEData,
EMsg=&'static str,
ECode=usize,
>
where
EMsg: std::fmt::Display,
ECode: num::Num + std::fmt::Display,
{
...
}
After:
pub enum JSendResponse<
SData,
FData=!,
EData=!,
EMsg=&'static str,
ECode=usize,
>
where
EMsg: std::fmt::Display,
ECode: num::Num + std::fmt::Display,
{
...
}
Meta
rustc --version --verbose
:
rustc 1.57.0-nightly (c1026539b 2021-10-15)
binary: rustc
commit-hash: c1026539bd22e9d070988deaa47b1360cbc76436
commit-date: 2021-10-15
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0
Error output
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/compiler/rustc_hir/src/definitions.rs:452:14
Backtrace
stack backtrace:
0: rust_begin_unwind
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/std/src/panicking.rs:517:5
1: core::panicking::panic_fmt
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/core/src/panicking.rs:100:14
2: core::panicking::panic
at /rustc/c1026539bd22e9d070988deaa47b1360cbc76436/library/core/src/panicking.rs:50:5
3: <rustc_query_impl::on_disk_cache::OnDiskCache as rustc_middle::ty::context::OnDiskCache>::def_path_hash_to_def_id
4: rustc_middle::dep_graph::dep_node::<impl rustc_query_system::dep_graph::dep_node::DepNodeParams<rustc_middle::ty::context::TyCtxt> for rustc_span::def_id::LocalDefId>::recover
5: rustc_query_impl::query_callbacks::hir_owner::force_from_dep_node
6: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
7: rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
8: rustc_query_system::query::plumbing::ensure_must_run
9: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
10: rustc_data_structures::sync::par_for_each_in
11: rustc_typeck::check::typeck_item_bodies
12: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
13: rustc_data_structures::stack::ensure_sufficient_stack
14: rustc_query_system::query::plumbing::try_execute_query
15: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
16: rustc_session::utils::<impl rustc_session::session::Session>::time
17: rustc_typeck::check_crate
18: rustc_interface::passes::analysis
19: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
20: rustc_data_structures::stack::ensure_sufficient_stack
21: rustc_query_system::query::plumbing::try_execute_query
22: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
23: rustc_interface::passes::QueryContext::enter
24: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
25: rustc_span::with_source_map
26: scoped_tls::ScopedKey<T>::set