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

thread 'rustc' panicked at 'region variables should not be hashed: '_#4r' #107616

Closed
chordtoll opened this issue Feb 3, 2023 · 3 comments
Closed
Assignees
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

@chordtoll
Copy link
Contributor

Code

use std::io::Read;

use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};

pub fn deserialize_from_wire<T: DeserializeOwned, R: Read>(mut recv: R) -> anyhow::Result<(T, R)> {
    todo!()
}

pub fn app<T: Read>(io: &mut T) -> Result<FuseRequest, u8> {
    let res: FuseRequest = deserialize_from_wire(io).unwrap().0;
    Ok(res)
}

#[derive(Debug, Serialize, Deserialize)]
pub enum FuseRequest {}

Dependencies:

  • serde = { version = "1.0", features = ["derive"] }

Meta

rustc --version --verbose:

rustc 1.67.0 (fc594f156 2023-01-24)
binary: rustc
commit-hash: fc594f15669680fa70d255faec3ca3fb507c3405
commit-date: 2023-01-24
host: x86_64-unknown-linux-gnu
release: 1.67.0
LLVM version: 15.0.6

(also present in rustc 1.68.0-beta.2 (10b73bf73 2023-02-01) and rustc 1.69.0-nightly (11d96b593 2023-02-01)

Error output

warning: unreachable expression
  --> soupfs-network/src/lib.rs:12:8
   |
11 |     let res: FuseRequest = deserialize_from_wire(io).unwrap().0;
   |                            ---------------------------------- any code following this expression is unreachable
12 |     Ok(res)
   |        ^^^ unreachable expression
   |
note: this expression has type `(FuseRequest, &mut T)`, which is uninhabited
  --> soupfs-network/src/lib.rs:11:28
   |
11 |     let res: FuseRequest = deserialize_from_wire(io).unwrap().0;
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: `#[warn(unreachable_code)]` on by default

warning: unused variable: `res`
  --> soupfs-network/src/lib.rs:11:9
   |
11 |     let res: FuseRequest = deserialize_from_wire(io).unwrap().0;
   |         ^^^ help: if this is intentional, prefix it with an underscore: `_res`
   |
   = note: `#[warn(unused_variables)]` on by default

thread 'rustc' panicked at 'region variables should not be hashed: '_#4r', /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/compiler/rustc_type_ir/src/sty.rs:1176:17
stack backtrace:
   0:     0x7f25e05676fa - std::backtrace_rs::backtrace::libunwind::trace::h34aec3ef6cd8ad7e
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f25e05676fa - std::backtrace_rs::backtrace::trace_unsynchronized::h8035d38698d0f7a8
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f25e05676fa - std::sys_common::backtrace::_print_fmt::hff968f6695a1ba22
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f25e05676fa - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7eea0efe77acf1ec
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f25e05ca25e - core::fmt::write::hc553f17407eb0b48
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/fmt/mod.rs:1208:17
   5:     0x7f25e0557a85 - std::io::Write::write_fmt::h62e5f01a089f48c0
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/io/mod.rs:1682:15
   6:     0x7f25e05674c5 - std::sys_common::backtrace::_print::h52d116aff3db4cd1
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f25e05674c5 - std::sys_common::backtrace::print::h9e7d2f98fb7af075
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f25e056a20f - std::panicking::default_hook::{{closure}}::hf74999dab2d0a95c
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/panicking.rs:267:22
   9:     0x7f25e0569f4b - std::panicking::default_hook::hc11ca7d10c44c42f
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/panicking.rs:286:9
  10:     0x7f25e386ac31 - rustc_driver[faf1f11f94aaf6ff]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f25e056aa4d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::ha7dbb2d260f78172
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/alloc/src/boxed.rs:2032:9
  12:     0x7f25e056aa4d - std::panicking::rust_panic_with_hook::hdb4da1ae79c845a5
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/panicking.rs:692:13
  13:     0x7f25e056a7c9 - std::panicking::begin_panic_handler::{{closure}}::h02b5b35b126d5cf2
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/panicking.rs:579:13
  14:     0x7f25e0567bac - std::sys_common::backtrace::__rust_end_short_backtrace::h6c6853376cf416d1
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/sys_common/backtrace.rs:137:18
  15:     0x7f25e056a4d2 - rust_begin_unwind
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/panicking.rs:575:5
  16:     0x7f25e05c6c43 - core::panicking::panic_fmt::hfd9e949092070b66
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/panicking.rs:64:14
  17:     0x7f25e212212f - <rustc_data_structures[7e2dc299a6484f3b]::intern::Interned<rustc_type_ir[2e8cf0e36bf06de0]::sty::RegionKind<rustc_middle[bcb6873cde329d56]::ty::context::TyCtxt>> as rustc_data_structures[7e2dc299a6484f3b]::stable_hasher::HashStable<rustc_query_system[daa376e8a1534a67]::ich::hcx::StableHashingContext>>::hash_stable
  18:     0x7f25e1bb3f2b - <rustc_type_ir[2e8cf0e36bf06de0]::ty_info::WithCachedTypeInfo<rustc_type_ir[2e8cf0e36bf06de0]::sty::TyKind<rustc_middle[bcb6873cde329d56]::ty::context::TyCtxt>> as rustc_data_structures[7e2dc299a6484f3b]::stable_hasher::HashStable<rustc_query_system[daa376e8a1534a67]::ich::hcx::StableHashingContext>>::hash_stable
  19:     0x7f25e20432a0 - <&rustc_middle[bcb6873cde329d56]::ty::list::List<rustc_middle[bcb6873cde329d56]::ty::Ty> as rustc_data_structures[7e2dc299a6484f3b]::stable_hasher::HashStable<rustc_query_system[daa376e8a1534a67]::ich::hcx::StableHashingContext>>::hash_stable
  20:     0x7f25e1bb4053 - <rustc_type_ir[2e8cf0e36bf06de0]::ty_info::WithCachedTypeInfo<rustc_type_ir[2e8cf0e36bf06de0]::sty::TyKind<rustc_middle[bcb6873cde329d56]::ty::context::TyCtxt>> as rustc_data_structures[7e2dc299a6484f3b]::stable_hasher::HashStable<rustc_query_system[daa376e8a1534a67]::ich::hcx::StableHashingContext>>::hash_stable
  21:     0x7f25e2206f6b - <rustc_query_system[daa376e8a1534a67]::dep_graph::dep_node::DepNode<rustc_middle[bcb6873cde329d56]::dep_graph::dep_node::DepKind>>::construct::<rustc_middle[bcb6873cde329d56]::ty::context::TyCtxt, rustc_middle[bcb6873cde329d56]::ty::Ty>
  22:     0x7f25e2205fe0 - rustc_query_system[daa376e8a1534a67]::query::plumbing::try_execute_query::<rustc_query_impl[7ca4c504d4b53a14]::plumbing::QueryCtxt, rustc_query_system[daa376e8a1534a67]::query::caches::DefaultCache<rustc_middle[bcb6873cde329d56]::ty::Ty, rustc_middle[bcb6873cde329d56]::ty::inhabitedness::inhabited_predicate::InhabitedPredicate>>
  23:     0x7f25e1f16e87 - <rustc_middle[bcb6873cde329d56]::ty::Ty>::is_privately_uninhabited
  24:     0x7f25e26f9a63 - <rustc_borrowck[dcfa3144f53dc2a2]::type_check::TypeChecker>::typeck_mir
  25:     0x7f25e267d633 - rustc_borrowck[dcfa3144f53dc2a2]::type_check::type_check
  26:     0x7f25e26541e5 - rustc_borrowck[dcfa3144f53dc2a2]::nll::compute_regions
  27:     0x7f25e2631e4b - rustc_borrowck[dcfa3144f53dc2a2]::do_mir_borrowck
  28:     0x7f25e262dc79 - rustc_borrowck[dcfa3144f53dc2a2]::mir_borrowck
  29:     0x7f25e262d155 - <rustc_borrowck[dcfa3144f53dc2a2]::provide::{closure#0} as core[e12cfea94acfcb96]::ops::function::FnOnce<(rustc_middle[bcb6873cde329d56]::ty::context::TyCtxt, rustc_span[5737ed96bfbdbd37]::def_id::LocalDefId)>>::call_once
  30:     0x7f25e29274dc - <rustc_query_system[daa376e8a1534a67]::dep_graph::graph::DepGraph<rustc_middle[bcb6873cde329d56]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[bcb6873cde329d56]::ty::context::TyCtxt, rustc_span[5737ed96bfbdbd37]::def_id::LocalDefId, &rustc_middle[bcb6873cde329d56]::mir::query::BorrowCheckResult>
  31:     0x7f25e29261ec - rustc_query_system[daa376e8a1534a67]::query::plumbing::try_execute_query::<rustc_query_impl[7ca4c504d4b53a14]::plumbing::QueryCtxt, rustc_query_system[daa376e8a1534a67]::query::caches::VecCache<rustc_span[5737ed96bfbdbd37]::def_id::LocalDefId, &rustc_middle[bcb6873cde329d56]::mir::query::BorrowCheckResult>>
  32:     0x7f25e1d64958 - rustc_data_structures[7e2dc299a6484f3b]::sync::par_for_each_in::<&[rustc_span[5737ed96bfbdbd37]::def_id::LocalDefId], <rustc_middle[bcb6873cde329d56]::hir::map::Map>::par_body_owners<rustc_interface[1d25fa3620f328b6]::passes::analysis::{closure#2}::{closure#0}>::{closure#0}>
  33:     0x7f25e1d643a3 - <rustc_session[d01ee0491e5e5048]::session::Session>::time::<(), rustc_interface[1d25fa3620f328b6]::passes::analysis::{closure#2}>
  34:     0x7f25e1d62227 - rustc_interface[1d25fa3620f328b6]::passes::analysis
  35:     0x7f25e3020ccf - <rustc_query_system[daa376e8a1534a67]::dep_graph::graph::DepGraph<rustc_middle[bcb6873cde329d56]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[bcb6873cde329d56]::ty::context::TyCtxt, (), core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>>
  36:     0x7f25e301fdc7 - rustc_query_system[daa376e8a1534a67]::query::plumbing::try_execute_query::<rustc_query_impl[7ca4c504d4b53a14]::plumbing::QueryCtxt, rustc_query_system[daa376e8a1534a67]::query::caches::DefaultCache<(), core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>>>
  37:     0x7f25e301f820 - rustc_query_system[daa376e8a1534a67]::query::plumbing::get_query::<rustc_query_impl[7ca4c504d4b53a14]::queries::analysis, rustc_query_impl[7ca4c504d4b53a14]::plumbing::QueryCtxt>
  38:     0x7f25e2a259a3 - <rustc_interface[1d25fa3620f328b6]::passes::QueryContext>::enter::<rustc_driver[faf1f11f94aaf6ff]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>>
  39:     0x7f25e2a21f23 - <rustc_interface[1d25fa3620f328b6]::interface::Compiler>::enter::<rustc_driver[faf1f11f94aaf6ff]::run_compiler::{closure#1}::{closure#2}, core[e12cfea94acfcb96]::result::Result<core[e12cfea94acfcb96]::option::Option<rustc_interface[1d25fa3620f328b6]::queries::Linker>, rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>>
  40:     0x7f25e2a1cf78 - rustc_span[5737ed96bfbdbd37]::with_source_map::<core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>, rustc_interface[1d25fa3620f328b6]::interface::run_compiler<core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>, rustc_driver[faf1f11f94aaf6ff]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  41:     0x7f25e2a1ca65 - <scoped_tls[85a67c9db469d989]::ScopedKey<rustc_span[5737ed96bfbdbd37]::SessionGlobals>>::set::<rustc_interface[1d25fa3620f328b6]::interface::run_compiler<core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>, rustc_driver[faf1f11f94aaf6ff]::run_compiler::{closure#1}>::{closure#0}, core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>>
  42:     0x7f25e2a1c052 - std[3da7f01c8c2aa3e3]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1d25fa3620f328b6]::util::run_in_thread_pool_with_globals<rustc_interface[1d25fa3620f328b6]::interface::run_compiler<core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>, rustc_driver[faf1f11f94aaf6ff]::run_compiler::{closure#1}>::{closure#0}, core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>>
  43:     0x7f25e3120bea - <<std[3da7f01c8c2aa3e3]::thread::Builder>::spawn_unchecked_<rustc_interface[1d25fa3620f328b6]::util::run_in_thread_pool_with_globals<rustc_interface[1d25fa3620f328b6]::interface::run_compiler<core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>, rustc_driver[faf1f11f94aaf6ff]::run_compiler::{closure#1}>::{closure#0}, core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e12cfea94acfcb96]::result::Result<(), rustc_errors[1b8cd632e3edc426]::ErrorGuaranteed>>::{closure#1} as core[e12cfea94acfcb96]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7f25e0574803 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha93239d92e7b610d
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/alloc/src/boxed.rs:2000:9
  45:     0x7f25e0574803 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hebda57b0236de612
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/alloc/src/boxed.rs:2000:9
  46:     0x7f25e0574803 - std::sys::unix::thread::Thread::new::thread_start::h1541b4390bbc26ca
                               at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7f25e02d58fd - <unknown>
  48:     0x7f25e0357d20 - <unknown>
  49:                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.67.0 (fc594f156 2023-01-24) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C panic=abort -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 [mir_borrowck] borrow-checking `app`
#1 [analysis] running analysis passes on this crate
end of query stack
@chordtoll chordtoll 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 Feb 3, 2023
@chordtoll
Copy link
Contributor Author

searched nightlies: from nightly-2022-12-15 to nightly-2023-02-02
regressed nightly: nightly-2022-12-18
searched commit range: 9c07efe...0468a00
regressed commit: 65c53c3

bisected with cargo-bisect-rustc v0.6.4

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start=2022-12-15 --end=2023-02-02

@compiler-errors
Copy link
Member

compiler-errors commented Feb 3, 2023

That bisection is wrong, 65c53c3 just restored the ICE message that bisect-rustc uses to determine when an ICE happens 😓

Anyways, this should be fixed by #107532.

@chordtoll
Copy link
Contributor Author

That checks out! I'll close this issue as a duplicate of #107505.

@compiler-errors compiler-errors self-assigned this Mar 16, 2023
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