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

ICE: type variables should not be hashed: _#0t #109768

Closed
matthiaskrgr opened this issue Mar 30, 2023 · 3 comments · Fixed by #109410
Closed

ICE: type variables should not be hashed: _#0t #109768

matthiaskrgr opened this issue Mar 30, 2023 · 3 comments · Fixed by #109410
Assignees
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Mar 30, 2023

Code

struct Wrapper<T>(T);

struct Local<T, U>(T, U);

impl<T> Local {
    type AssocType3 = T;

    const WRAPPED_ASSOC_3: Wrapper<Self::AssocType3> = Wrapper();
}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (17c116721 2023-03-29)
binary: rustc
commit-hash: 17c11672167827b0dd92c88ef69f24346d1286dd
commit-date: 2023-03-29
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 16.0.0

Bisection points to

searched toolchains 7aa413d59206fd511137728df3d9e0fd377429bd through 5243ea5c29b136137c36bd773e5baa663790e097


********************************************************************************
Regression in 7b552967b8ed122aa949cddac8c2270b6490e64e
*******************************************************************************

#105961 cc @fmease

Error output

rustc /tmp/im/treereduce.out -Cincremental=.

error[E0601]: `main` function not found in crate `treereduce`
 --> /tmp/im/treereduce.out:9:2
  |
9 | }
  |  ^ consider adding a `main` function to `/tmp/im/treereduce.out`

error[E0107]: missing generics for struct `Local`
 --> /tmp/im/treereduce.out:5:9
  |
5 | impl<T> Local {
  |         ^^^^^ expected 2 generic arguments
  |
note: struct defined here, with 2 generic parameters: `T`, `U`
 --> /tmp/im/treereduce.out:3:8
  |
3 | struct Local<T, U>(T, U);
  |        ^^^^^ -  -
help: add missing generic arguments
  |
5 | impl<T> Local<T, U> {
  |              ++++++

error[E0658]: inherent associated types are unstable
 --> /tmp/im/treereduce.out:6:5
  |
6 |     type AssocType3 = T;
  |     ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
  = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
Backtrace

thread 'rustc' panicked at 'type variables should not be hashed: _#0t', /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/compiler/rustc_type_ir/src/lib.rs:718:17
stack backtrace:
   0:     0x7ff5b4b65e8a - std::backtrace_rs::backtrace::libunwind::trace::hc07ec51854030801
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7ff5b4b65e8a - std::backtrace_rs::backtrace::trace_unsynchronized::hd5249f53d09c2c41
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff5b4b65e8a - std::sys_common::backtrace::_print_fmt::h7a58bb30aee44196
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7ff5b4b65e8a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4f2b7c295e3f8019
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ff5b4bc9e6f - core::fmt::write::h10777037b979b8b8
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/core/src/fmt/mod.rs:1254:17
   5:     0x7ff5b4b58ac5 - std::io::Write::write_fmt::he1dc4aa4bd2563db
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/io/mod.rs:1698:15
   6:     0x7ff5b4b65c55 - std::sys_common::backtrace::_print::h163c7799d3150ce8
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7ff5b4b65c55 - std::sys_common::backtrace::print::h3cf13564ddfd5c0e
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7ff5b4b688fe - std::panicking::default_hook::{{closure}}::h999811fec35f64bf
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/panicking.rs:269:22
   9:     0x7ff5b4b686a5 - std::panicking::default_hook::he182d48ca482e8b2
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/panicking.rs:288:9
  10:     0x7ff5b7e8bfe5 - <rustc_driver_impl[97cc8afb29750871]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[a19e7c0c634483f1]::ops::function::FnOnce<(&core[a19e7c0c634483f1]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7ff5b4b690f4 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h85e02727d0be9156
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/alloc/src/boxed.rs:2002:9
  12:     0x7ff5b4b690f4 - std::panicking::rust_panic_with_hook::h2bc066147eaf9845
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/panicking.rs:694:13
  13:     0x7ff5b4b68e69 - std::panicking::begin_panic_handler::{{closure}}::h1e4368c427832fe9
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/panicking.rs:581:13
  14:     0x7ff5b4b662f6 - std::sys_common::backtrace::__rust_end_short_backtrace::h5466480ef33b438e
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7ff5b4b68bc2 - rust_begin_unwind
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/panicking.rs:577:5
  16:     0x7ff5b4bc6273 - core::panicking::panic_fmt::ha28b6d803d12671b
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/core/src/panicking.rs:67:14
  17:     0x7ff5b838ff0b - <rustc_type_ir[45884c32f46deb2e]::InferTy as rustc_data_structures[cd2fe1ee8a53a3e]::stable_hasher::HashStable<rustc_query_system[1d2d9265d336f3ba]::ich::hcx::StableHashingContext>>::hash_stable
  18:     0x7ff5b5de669e - <rustc_type_ir[45884c32f46deb2e]::ty_info::WithCachedTypeInfo<rustc_type_ir[45884c32f46deb2e]::sty::TyKind<rustc_middle[3082ae73db43cedc]::ty::context::TyCtxt>> as rustc_data_structures[cd2fe1ee8a53a3e]::stable_hasher::HashStable<rustc_query_system[1d2d9265d336f3ba]::ich::hcx::StableHashingContext>>::hash_stable
  19:     0x7ff5b659fe4c - <&rustc_middle[3082ae73db43cedc]::ty::list::List<rustc_middle[3082ae73db43cedc]::ty::subst::GenericArg> as rustc_data_structures[cd2fe1ee8a53a3e]::stable_hasher::HashStable<rustc_query_system[1d2d9265d336f3ba]::ich::hcx::StableHashingContext>>::hash_stable
  20:     0x7ff5b5fbfd01 - <rustc_type_ir[45884c32f46deb2e]::ty_info::WithCachedTypeInfo<rustc_type_ir[45884c32f46deb2e]::sty::TyKind<rustc_middle[3082ae73db43cedc]::ty::context::TyCtxt>> as rustc_data_structures[cd2fe1ee8a53a3e]::stable_hasher::HashStable<rustc_query_system[1d2d9265d336f3ba]::ich::hcx::StableHashingContext>>::hash_stable
  21:     0x7ff5b64edcb3 - rustc_query_system[1d2d9265d336f3ba]::dep_graph::graph::hash_result::<rustc_middle[3082ae73db43cedc]::ty::subst::EarlyBinder<rustc_middle[3082ae73db43cedc]::ty::Ty>>
  22:     0x7ff5b64ed685 - <std[6ff7f37a454f70cc]::thread::local::LocalKey<core[a19e7c0c634483f1]::cell::Cell<*const ()>>>::with::<rustc_middle[3082ae73db43cedc]::ty::context::tls::enter_context<rustc_query_system[1d2d9265d336f3ba]::query::plumbing::execute_job_incr<rustc_query_impl[7fc8fbd6a7380a6b]::queries::type_of, rustc_query_impl[7fc8fbd6a7380a6b]::plumbing::QueryCtxt>::{closure#2}, (rustc_middle[3082ae73db43cedc]::ty::subst::EarlyBinder<rustc_middle[3082ae73db43cedc]::ty::Ty>, rustc_query_system[1d2d9265d336f3ba]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle[3082ae73db43cedc]::ty::subst::EarlyBinder<rustc_middle[3082ae73db43cedc]::ty::Ty>, rustc_query_system[1d2d9265d336f3ba]::dep_graph::graph::DepNodeIndex)>
  23:     0x7ff5b64ebf98 - rustc_query_system[1d2d9265d336f3ba]::query::plumbing::try_execute_query::<rustc_query_impl[7fc8fbd6a7380a6b]::queries::type_of, rustc_query_impl[7fc8fbd6a7380a6b]::plumbing::QueryCtxt>
  24:     0x7ff5b643fbb6 - <rustc_hir_analysis[765c0daf36b03a69]::collect::CollectItemTypesVisitor as rustc_hir[c06c39e7dae5b071]::intravisit::Visitor>::visit_impl_item
  25:     0x7ff5b643ab7e - <rustc_middle[3082ae73db43cedc]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir_analysis[765c0daf36b03a69]::collect::CollectItemTypesVisitor>
  26:     0x7ff5b643aa0c - rustc_hir_analysis[765c0daf36b03a69]::collect::collect_mod_item_types
  27:     0x7ff5b7484cc2 - <std[6ff7f37a454f70cc]::thread::local::LocalKey<core[a19e7c0c634483f1]::cell::Cell<*const ()>>>::with::<rustc_middle[3082ae73db43cedc]::ty::context::tls::enter_context<rustc_query_system[1d2d9265d336f3ba]::query::plumbing::execute_job_incr<rustc_query_impl[7fc8fbd6a7380a6b]::queries::collect_mod_item_types, rustc_query_impl[7fc8fbd6a7380a6b]::plumbing::QueryCtxt>::{closure#2}, ((), rustc_query_system[1d2d9265d336f3ba]::dep_graph::graph::DepNodeIndex)>::{closure#0}, ((), rustc_query_system[1d2d9265d336f3ba]::dep_graph::graph::DepNodeIndex)>
  28:     0x7ff5b748461d - rustc_query_system[1d2d9265d336f3ba]::query::plumbing::try_execute_query::<rustc_query_impl[7fc8fbd6a7380a6b]::queries::collect_mod_item_types, rustc_query_impl[7fc8fbd6a7380a6b]::plumbing::QueryCtxt>
  29:     0x7ff5b7484039 - <rustc_query_impl[7fc8fbd6a7380a6b]::Queries as rustc_middle[3082ae73db43cedc]::ty::query::QueryEngine>::collect_mod_item_types
  30:     0x7ff5b72ed83f - <rustc_session[cf9a7d3e591cdb18]::session::Session>::track_errors::<rustc_hir_analysis[765c0daf36b03a69]::check_crate::{closure#0}, ()>
  31:     0x7ff5b72e9ec1 - rustc_hir_analysis[765c0daf36b03a69]::check_crate
  32:     0x7ff5b72e3dd1 - rustc_interface[5bf2b96a334089ac]::passes::analysis
  33:     0x7ff5b76434ca - <std[6ff7f37a454f70cc]::thread::local::LocalKey<core[a19e7c0c634483f1]::cell::Cell<*const ()>>>::with::<rustc_middle[3082ae73db43cedc]::ty::context::tls::enter_context<rustc_query_system[1d2d9265d336f3ba]::query::plumbing::execute_job_incr<rustc_query_impl[7fc8fbd6a7380a6b]::queries::analysis, rustc_query_impl[7fc8fbd6a7380a6b]::plumbing::QueryCtxt>::{closure#2}, (core[a19e7c0c634483f1]::result::Result<(), rustc_span[e810f079a636b72c]::ErrorGuaranteed>, rustc_query_system[1d2d9265d336f3ba]::dep_graph::graph::DepNodeIndex)>::{closure#0}, (core[a19e7c0c634483f1]::result::Result<(), rustc_span[e810f079a636b72c]::ErrorGuaranteed>, rustc_query_system[1d2d9265d336f3ba]::dep_graph::graph::DepNodeIndex)>
  34:     0x7ff5b764301f - rustc_query_system[1d2d9265d336f3ba]::query::plumbing::try_execute_query::<rustc_query_impl[7fc8fbd6a7380a6b]::queries::analysis, rustc_query_impl[7fc8fbd6a7380a6b]::plumbing::QueryCtxt>
  35:     0x7ff5b7642b80 - <rustc_query_impl[7fc8fbd6a7380a6b]::Queries as rustc_middle[3082ae73db43cedc]::ty::query::QueryEngine>::analysis
  36:     0x7ff5b6fe12be - <rustc_interface[5bf2b96a334089ac]::queries::QueryResult<&rustc_middle[3082ae73db43cedc]::ty::context::GlobalCtxt>>::enter::<core[a19e7c0c634483f1]::result::Result<(), rustc_span[e810f079a636b72c]::ErrorGuaranteed>, rustc_driver_impl[97cc8afb29750871]::run_compiler::{closure#1}::{closure#2}::{closure#4}>
  37:     0x7ff5b6fdfe5e - <rustc_interface[5bf2b96a334089ac]::interface::Compiler>::enter::<rustc_driver_impl[97cc8afb29750871]::run_compiler::{closure#1}::{closure#2}, core[a19e7c0c634483f1]::result::Result<core[a19e7c0c634483f1]::option::Option<rustc_interface[5bf2b96a334089ac]::queries::Linker>, rustc_span[e810f079a636b72c]::ErrorGuaranteed>>
  38:     0x7ff5b6fde011 - rustc_span[e810f079a636b72c]::with_source_map::<core[a19e7c0c634483f1]::result::Result<(), rustc_span[e810f079a636b72c]::ErrorGuaranteed>, rustc_interface[5bf2b96a334089ac]::interface::run_compiler<core[a19e7c0c634483f1]::result::Result<(), rustc_span[e810f079a636b72c]::ErrorGuaranteed>, rustc_driver_impl[97cc8afb29750871]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  39:     0x7ff5b6fdd5bf - std[6ff7f37a454f70cc]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5bf2b96a334089ac]::util::run_in_thread_pool_with_globals<rustc_interface[5bf2b96a334089ac]::interface::run_compiler<core[a19e7c0c634483f1]::result::Result<(), rustc_span[e810f079a636b72c]::ErrorGuaranteed>, rustc_driver_impl[97cc8afb29750871]::run_compiler::{closure#1}>::{closure#0}, core[a19e7c0c634483f1]::result::Result<(), rustc_span[e810f079a636b72c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a19e7c0c634483f1]::result::Result<(), rustc_span[e810f079a636b72c]::ErrorGuaranteed>>
  40:     0x7ff5b772084e - <<std[6ff7f37a454f70cc]::thread::Builder>::spawn_unchecked_<rustc_interface[5bf2b96a334089ac]::util::run_in_thread_pool_with_globals<rustc_interface[5bf2b96a334089ac]::interface::run_compiler<core[a19e7c0c634483f1]::result::Result<(), rustc_span[e810f079a636b72c]::ErrorGuaranteed>, rustc_driver_impl[97cc8afb29750871]::run_compiler::{closure#1}>::{closure#0}, core[a19e7c0c634483f1]::result::Result<(), rustc_span[e810f079a636b72c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a19e7c0c634483f1]::result::Result<(), rustc_span[e810f079a636b72c]::ErrorGuaranteed>>::{closure#1} as core[a19e7c0c634483f1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7ff5b4b731d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfe54f4b2f7bbb15c
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/alloc/src/boxed.rs:1988:9
  42:     0x7ff5b4b731d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h63491a9a6e102885
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/alloc/src/boxed.rs:1988:9
  43:     0x7ff5b4b731d5 - std::sys::unix::thread::Thread::new::thread_start::h7f7d825730b043c8
                               at /rustc/17c11672167827b0dd92c88ef69f24346d1286dd/library/std/src/sys/unix/thread.rs:108:17
  44:     0x7ff5b490dbb5 - <unknown>
  45:     0x7ff5b498fd90 - <unknown>
  46:                0x0 - <unknown>

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.70.0-nightly (17c116721 2023-03-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -C incremental=[REDACTED]

query stack during panic:
#0 [type_of] computing type of `<impl at /tmp/im/treereduce.out:5:1: 5:14>::WRAPPED_ASSOC_3`
#1 [collect_mod_item_types] collecting item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0107, E0601, E0658.
For more information about an error, try `rustc --explain E0107`.

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. regression-from-stable-to-beta Performance or correctness regression from stable to beta. A-incr-comp Area: Incremental compilation S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue labels Mar 30, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 30, 2023
@fmease
Copy link
Member

fmease commented Mar 30, 2023

Should already be fixed in #109410, let me check. Edit: It is. Gonna push a regression test later.
@rustbot claim

@fmease
Copy link
Member

fmease commented Mar 31, 2023

Regression test added.

@apiraino
Copy link
Contributor

apiraino commented Apr 3, 2023

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 3, 2023
@bors bors closed this as completed in 29ac429 May 8, 2023
flip1995 pushed a commit to flip1995/rust that referenced this issue May 20, 2023
…compiler-errors

Introduce `AliasKind::Inherent` for inherent associated types

Allows us to check (possibly generic) inherent associated types for well-formedness.
Type inference now also works properly.

Follow-up to rust-lang#105961. Supersedes rust-lang#108430.
Fixes rust-lang#106722.
Fixes rust-lang#108957.
Fixes rust-lang#109768.
Fixes rust-lang#109789.
Fixes rust-lang#109790.

~Not to be merged before rust-lang#108860 (`AliasKind::Weak`).~

CC `@jackh726`
r? `@compiler-errors`

`@rustbot` label T-types F-inherent_associated_types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants