Repository: rust
Issue: Unexpected rustc panic
Labels: I-ICE,T-compiler,C-bug,S-needs-repro

I was modifying my Cargo.toml file, when I have commented 2 lines of it, representing the crates `tokio-utils` and `tokio-stream`, the compiler unexpectedly panicked.

This is my Cargo.toml file:

    [package]
    name = "turdb"
    version = "0.1.0"
    edition = "2021"

    [dependencies]
    tokio = { version = "1.2.21", features = ["full"] }
    #tokio-stream = { version = "0.1.11", features = ["net"] }
    #tokio-util = { version = "0.7.4", features = ["full"] }
    serde = { version = "1.0.144", features = ["derive"] }
    nix = { version = "0.25.0", features = ["signal"] }
    log = { version = "0.4", features = ["max_level_trace", "release_max_level_info"] }
    clap = { version = "4.0.19", features = ["derive"] }
    env_logger = "0.9.1"
    daemonize = "0.4.1"
    toml = "0.5"
    paste = "0.1.5"
    bytes = "1.1.0"
    num_cpus = "1.13.1"
    proctitle = "0.1.1"
    futures = "0.3.24"
    chrono = "0.4"
    home = "0.5.4"
    rpassword = "7.0.0"
    dirs = "4.0.0"


I completely removed those '#'-marked lines, but I left them here with '#' so you can see them.
When I typed `cargo build` again, after removing them, this was the rustc output:
````
$  cargo build
   Compiling turdb v0.1.0 (/data/devz/turdb)
thread 'rustc' panicked at 'Failed to extract DefId: local_def_id_to_hir_id f8931ba8b618df26-59328d36bea59fce', compiler/rustc_middle/src/dep_graph/dep_node.rs:267:17
stack backtrace:
   0:     0x7f3037985d40 - std::backtrace_rs::backtrace::libunwind::trace::h32eb3e08e874dd27
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3037985d40 - std::backtrace_rs::backtrace::trace_unsynchronized::haa3f451d27bc11a5
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3037985d40 - std::sys_common::backtrace::_print_fmt::h5b94a01bb4289bb5
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f3037985d40 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb070b7fa7e3175df
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f30379e0bfe - core::fmt::write::hd5207aebbb9a86e9
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f3037976935 - std::io::Write::write_fmt::h3bd699bbd129ab8a
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/io/mod.rs:1679:15
   6:     0x7f30379889f3 - std::sys_common::backtrace::_print::h7a21be552fdf58da
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f30379889f3 - std::sys_common::backtrace::print::ha85c41fe4dd80b13
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f30379889f3 - std::panicking::default_hook::{{closure}}::h04cca40023d0eeca
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:295:22
   9:     0x7f30379886df - std::panicking::default_hook::haa3ca8c310ed5402
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:314:9
  10:     0x7f303a1b62e1 - rustc_driver[cfb34b1539811fe8]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f303798922d - std::panicking::rust_panic_with_hook::h7b190ce1a948faac
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:702:17
  12:     0x7f3037989087 - std::panicking::begin_panic_handler::{{closure}}::hbafbfdc3e1b97f68
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:588:13
  13:     0x7f30379861ec - std::sys_common::backtrace::__rust_end_short_backtrace::hda93e5fef243b4c0
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f3037988da2 - rust_begin_unwind
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5
  15:     0x7f30379dd7d3 - core::panicking::panic_fmt::h8d17ca1073d9a733
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14
  16:     0x7f303b1d3f61 - <rustc_query_system[860ed7b39cdfb46b]::dep_graph::dep_node::DepNode<rustc_middle[a9ca1c3f9fd197cd]::dep_graph::dep_node::DepKind> as rustc_middle[a9ca1c3f9fd197cd]::dep_graph::dep_node::DepNodeExt>::extract_def_id::{closure#0}
  17:     0x7f3038aeae3b - <rustc_query_system[860ed7b39cdfb46b]::dep_graph::dep_node::DepNode<rustc_middle[a9ca1c3f9fd197cd]::dep_graph::dep_node::DepKind> as rustc_middle[a9ca1c3f9fd197cd]::dep_graph::dep_node::DepNodeExt>::extract_def_id
  18:     0x7f3039ad26bc - rustc_query_impl[d6191eea714bd250]::plumbing::force_from_dep_node::<rustc_query_impl[d6191eea714bd250]::queries::local_def_id_to_hir_id>
  19:     0x7f3038c3c291 - <rustc_middle[a9ca1c3f9fd197cd]::ty::context::TyCtxt as rustc_query_system[860ed7b39cdfb46b]::dep_graph::DepContext>::try_force_from_dep_node
  20:     0x7f3038c3b022 - <rustc_query_system[860ed7b39cdfb46b]::dep_graph::graph::DepGraph<rustc_middle[a9ca1c3f9fd197cd]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[d6191eea714bd250]::plumbing::QueryCtxt>
  21:     0x7f3038c3aff0 - <rustc_query_system[860ed7b39cdfb46b]::dep_graph::graph::DepGraph<rustc_middle[a9ca1c3f9fd197cd]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[d6191eea714bd250]::plumbing::QueryCtxt>
  22:     0x7f3039269352 - rustc_query_system[860ed7b39cdfb46b]::query::plumbing::ensure_must_run::<rustc_query_impl[d6191eea714bd250]::plumbing::QueryCtxt, rustc_span[8f00505efff112e2]::def_id::LocalDefId, ()>
  23:     0x7f3039c1b915 - rustc_query_system[860ed7b39cdfb46b]::query::plumbing::get_query::<rustc_query_impl[d6191eea714bd250]::queries::check_mod_item_types, rustc_query_impl[d6191eea714bd250]::plumbing::QueryCtxt>
  24:     0x7f3039ed5f8c - <rustc_middle[a9ca1c3f9fd197cd]::hir::map::Map>::for_each_module::<rustc_typeck[4a3b2f91c49b3c3e]::check_crate::{closure#6}::{closure#0}>
  25:     0x7f3039529635 - rustc_typeck[4a3b2f91c49b3c3e]::check_crate
  26:     0x7f3039528c27 - rustc_interface[3182dd864eff9d7d]::passes::analysis
  27:     0x7f3039f87382 - <rustc_query_system[860ed7b39cdfb46b]::dep_graph::graph::DepGraph<rustc_middle[a9ca1c3f9fd197cd]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[a9ca1c3f9fd197cd]::ty::context::TyCtxt, (), core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>
  28:     0x7f3039f86a4a - rustc_query_system[860ed7b39cdfb46b]::query::plumbing::try_execute_query::<rustc_query_impl[d6191eea714bd250]::plumbing::QueryCtxt, rustc_query_system[860ed7b39cdfb46b]::query::caches::DefaultCache<(), core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>>
  29:     0x7f3039f86517 - rustc_query_system[860ed7b39cdfb46b]::query::plumbing::get_query::<rustc_query_impl[d6191eea714bd250]::queries::analysis, rustc_query_impl[d6191eea714bd250]::plumbing::QueryCtxt>
  30:     0x7f3039072897 - <rustc_interface[3182dd864eff9d7d]::passes::QueryContext>::enter::<rustc_driver[cfb34b1539811fe8]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>
  31:     0x7f303906628c - rustc_interface[3182dd864eff9d7d]::interface::create_compiler_and_run::<core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>, rustc_driver[cfb34b1539811fe8]::run_compiler::{closure#1}>
  32:     0x7f3039064ac1 - <scoped_tls[e395fa6e23b19669]::ScopedKey<rustc_span[8f00505efff112e2]::SessionGlobals>>::set::<rustc_interface[3182dd864eff9d7d]::interface::run_compiler<core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>, rustc_driver[cfb34b1539811fe8]::run_compiler::{closure#1}>::{closure#0}, core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>
  33:     0x7f30390647af - std[71cb4861428b0c25]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3182dd864eff9d7d]::util::run_in_thread_pool_with_globals<rustc_interface[3182dd864eff9d7d]::interface::run_compiler<core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>, rustc_driver[cfb34b1539811fe8]::run_compiler::{closure#1}>::{closure#0}, core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>::{closure#0}, core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>
  34:     0x7f303a019d70 - <<std[71cb4861428b0c25]::thread::Builder>::spawn_unchecked_<rustc_interface[3182dd864eff9d7d]::util::run_in_thread_pool_with_globals<rustc_interface[3182dd864eff9d7d]::interface::run_compiler<core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>, rustc_driver[cfb34b1539811fe8]::run_compiler::{closure#1}>::{closure#0}, core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>::{closure#0}, core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>::{closure#1} as core[8c92e53db3fc2eaa]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:     0x7f3037993003 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h49f797984e2121bf
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/alloc/src/boxed.rs:1940:9
  36:     0x7f3037993003 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfa4f3d0ee6440e0b
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/alloc/src/boxed.rs:1940:9
  37:     0x7f3037993003 - std::sys::unix::thread::Thread::new::thread_start::h62ca48b42d48a8fc
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys/unix/thread.rs:108:17
  38:     0x7f3037853ea7 - start_thread
  39:     0x7f3037771a2f - clone
  40:                0x0 - <unknown>

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.65.0 (897e37553 2022-11-02) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -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 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `turdb`
````

Hope this helps!