ICE: type variables should not be hashed #109864
Labels
C-bug
Category: This is a bug.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
S-has-mcve
Status: A Minimal Complete and Verifiable Example has been found for this issue
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Build with
cargo check
orrustc main.rs --crate-type lib -C incremental=./target/debug/incremental -L dependency=./target/debug/deps
Meta
Runnng with
rustc +nightly main.rs --crate-type lib -C incremental=./target/debug/incremental -L dependency=./target/debug/deps
does not produce compiler panicrustc --version --verbose
:Error output
rustc main.rs --crate-type lib -C incremental=./target/debug/incremental -L dependency=./target/debug/deps
:cargo +beta build
:rustc +nightly main.rs --crate-type lib -C incremental=./target/debug/incremental -L dependency=./target/debug/deps
:Backtrace
```error[E0392]: parameter
P
is never used--> src/lib.rs:2:11
|
2 | struct S2
();
| ^ unused parameter
|
= help: consider removing `P`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `P` to be a const parameter, use `const P: usize` instead
error[E0277]: the trait bound
<A as Foo<B>>::Out: Qux<S>
is not satisfied--> src/lib.rs:23:10
|
23 | <<<A as Foo>::Out as Qux
>::Out as Fuzz<S2>>::Out,| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait
Qux<S>
is not implemented for<A as Foo<B>>::Out
|
help: consider further restricting the associated type
|
20 | impl<A: Foo, B> Fuzz<S2> for S2 where <A as Foo>::Out: Qux
{| ++++++++++++++++++++++++++++++++
thread 'rustc' panicked at 'type variables should not be hashed: _#1t', /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/compiler/rustc_type_ir/src/lib.rs:681:17
stack backtrace:
0: rust_begin_unwind
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/panicking.rs:64:14
2: <rustc_type_ir::InferTy as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
3: <rustc_type_ir::ty_info::WithCachedTypeInfo<rustc_type_ir::sty::TyKind<rustc_middle::ty::context::TyCtxt>> as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
4: <&rustc_middle::ty::list::List<rustc_middle::ty::subst::GenericArg> as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
5: <rustc_data_structures::intern::Interned<rustc_type_ir::ty_info::WithCachedTypeInfo<rustc_middle::ty::sty::Binder<rustc_middle::ty::PredicateKind>>> as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
6: <(rustc_middle::ty::Predicate, rustc_middle::traits::WellFormedLoc) as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
7: <rustc_query_system::query::config::QueryVTable<rustc_query_impl::plumbing::QueryCtxt, (rustc_middle::ty::Predicate, rustc_middle::traits::WellFormedLoc), core::option::Option<rustc_middle::traits::ObligationCause>>>::to_dep_node
8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::ArenaCache<(rustc_middle::ty::Predicate, rustc_middle::traits::WellFormedLoc), core::option::Option<rustc_middle::traits::ObligationCause>>>
9: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::diagnostic_hir_wf_check, rustc_query_impl::plumbing::QueryCtxt>
10: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::diagnostic_hir_wf_check
11: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt>::report_selection_error
12: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
13: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
14: rustc_hir_analysis::check::wfcheck::check_associated_item
15: rustc_hir_analysis::check::wfcheck::check_well_formed
16: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_hir::hir_id::OwnerId, ()>
17: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::check_well_formed, rustc_query_impl::plumbing::QueryCtxt>
18: rustc_data_structures::sync::par_for_each_in::<&[rustc_hir::hir::ImplItemId], <rustc_middle::hir::ModuleItems>::par_impl_items<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure#1}>::{closure#0}>
19: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
20: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, ()>
21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, ()>>
22: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::check_mod_type_wf, rustc_query_impl::plumbing::QueryCtxt>
23: rustc_data_structures::sync::par_for_each_in::<&[rustc_hir::hir_id::OwnerId], <rustc_middle::hir::map::Map>::par_for_each_module<rustc_hir_analysis::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
24: <rustc_session::session::Session>::track_errors::<rustc_hir_analysis::check_crate::{closure#5}, ()>
25: rustc_hir_analysis::check_crate
26: rustc_interface::passes::analysis
27: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
28: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorGuaranteed>>>
29: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
30: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#2}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
31: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
32: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
33: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with
RUST_BACKTRACE=full
for a verbose backtrace.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.1 (d5a82bb 2023-02-07) 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 [diagnostic_hir_wf_check] performing HIR wf-checking for predicate
Binder(TraitPredicate(<<A as Foo<B>>::Out as Bar<S2<A>, _>>, polarity:Positive), [])
at itemTy(DefId(0:24 ~ xuwunum_rev[2847]::{impl#0}::Out))
#1 [check_well_formed] checking that
<impl at src/lib.rs:20:1: 20:41>::Out
is well-formed#2 [check_mod_type_wf] checking that types are well-formed in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
Some errors have detailed explanations: E0277, E0392.
For more information about an error, try
rustc --explain E0277
.error: could not compile
xuwunum-rev
due to 2 previous errorsThe text was updated successfully, but these errors were encountered: