Repository: rust
Issue: ICE in TaggedSerializer (serde)
Labels: I-ICE,T-compiler,C-bug,T-types

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
-->

### Code

Sorry, can't provide code - it's from serde_json usage in proprietary code

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc --version --verbose
rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-unknown-linux-gnu
release: 1.79.0
LLVM version: 18.1.7
```

### Error output

```
➜  RUST_BACKTRACE=1 cargo test -- 'testname'

[misc package names omitted...]

thread 'rustc' panicked at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/compiler/rustc_type_ir/src/ty_kind.rs:709:17:
type variables should not be hashed: ?0t
stack backtrace:
   0: rust_begin_unwind
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:652:5
   1: core::panicking::panic_fmt
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/panicking.rs:72:14
   2: <rustc_type_ir::ty_info::WithCachedTypeInfo<rustc_type_ir::ty_kind::TyKind<rustc_middle::ty::context::TyCtxt>> 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::ty_kind::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::RawList<(), rustc_middle::ty::Ty> as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
   5: <rustc_type_ir::ty_info::WithCachedTypeInfo<rustc_type_ir::ty_kind::TyKind<rustc_middle::ty::context::TyCtxt>> as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
   6: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg> as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
   7: <rustc_type_ir::ty_info::WithCachedTypeInfo<rustc_type_ir::ty_kind::TyKind<rustc_middle::ty::context::TyCtxt>> as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
   8: <rustc_type_ir::ty_info::WithCachedTypeInfo<rustc_type_ir::ty_kind::TyKind<rustc_middle::ty::context::TyCtxt>> as rustc_data_structures::stable_hasher::HashStable<rustc_query_system::ich::hcx::StableHashingContext>>::hash_stable
   9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::generic_args::GenericArg>, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
  10: <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty
  11: rustc_monomorphize::collector::collect_items_rec::{closure#0}
  12: rustc_monomorphize::collector::collect_items_rec
  13: rustc_monomorphize::collector::collect_items_rec
  14: rustc_monomorphize::collector::collect_items_rec
  15: rustc_monomorphize::collector::collect_items_rec
  16: rustc_monomorphize::collector::collect_items_rec
  17: rustc_monomorphize::collector::collect_items_rec
  18: rustc_monomorphize::collector::collect_items_rec
  19: rustc_monomorphize::collector::collect_items_rec
  20: rustc_monomorphize::collector::collect_items_rec
  21: rustc_monomorphize::collector::collect_items_rec
  22: rustc_monomorphize::collector::collect_items_rec
  23: rustc_monomorphize::collector::collect_items_rec
  24: rustc_monomorphize::collector::collect_items_rec
  25: rustc_monomorphize::collector::collect_items_rec
  26: rustc_monomorphize::collector::collect_items_rec
  27: rustc_monomorphize::collector::collect_items_rec
  28: rustc_monomorphize::collector::collect_items_rec
  29: rustc_monomorphize::collector::collect_items_rec
  30: rustc_monomorphize::collector::collect_items_rec
  31: rustc_monomorphize::collector::collect_items_rec
  32: rustc_monomorphize::collector::collect_items_rec
  33: rustc_monomorphize::collector::collect_items_rec
  34: rustc_monomorphize::collector::collect_items_rec
  35: rustc_monomorphize::collector::collect_items_rec
  36: rustc_monomorphize::collector::collect_items_rec
  37: rustc_monomorphize::collector::collect_items_rec
  38: rustc_monomorphize::collector::collect_items_rec
  39: rustc_monomorphize::collector::collect_items_rec
  40: rustc_monomorphize::collector::collect_items_rec
  41: rustc_monomorphize::collector::collect_items_rec
  42: rustc_monomorphize::collector::collect_items_rec
  43: rustc_monomorphize::collector::collect_items_rec
  44: rustc_monomorphize::collector::collect_items_rec
  45: rustc_monomorphize::collector::collect_items_rec
  46: rustc_monomorphize::collector::collect_items_rec
  47: rustc_monomorphize::collector::collect_items_rec
  48: rustc_monomorphize::collector::collect_items_rec
  49: rustc_monomorphize::collector::collect_items_rec
  50: rustc_monomorphize::collector::collect_items_rec
  51: rustc_monomorphize::collector::collect_items_rec
  52: rustc_monomorphize::collector::collect_items_rec
  53: rustc_monomorphize::collector::collect_items_rec
  54: rustc_monomorphize::collector::collect_items_rec
  55: rustc_monomorphize::collector::collect_items_rec
  56: rustc_monomorphize::collector::collect_items_rec
  57: rustc_monomorphize::collector::collect_items_rec
  58: rustc_monomorphize::collector::collect_items_rec
  59: rustc_monomorphize::collector::collect_items_rec
  60: rustc_monomorphize::collector::collect_items_rec
  61: rustc_monomorphize::collector::collect_items_rec
  62: rustc_monomorphize::collector::collect_items_rec
  63: rustc_monomorphize::collector::collect_items_rec
  64: rustc_monomorphize::collector::collect_items_rec
  65: rustc_monomorphize::collector::collect_items_rec
  66: rustc_monomorphize::collector::collect_items_rec
  67: rustc_monomorphize::collector::collect_items_rec
  68: rustc_monomorphize::collector::collect_items_rec
  69: rustc_monomorphize::collector::collect_items_rec
  70: rustc_monomorphize::collector::collect_items_rec
  71: rustc_monomorphize::collector::collect_items_rec
  72: rustc_monomorphize::collector::collect_items_rec
  73: rustc_monomorphize::collector::collect_items_rec
  74: rustc_monomorphize::collector::collect_items_rec
  75: rustc_monomorphize::collector::collect_items_rec
  76: rustc_monomorphize::collector::collect_items_rec
  77: rustc_monomorphize::collector::collect_items_rec
  78: rustc_monomorphize::collector::collect_items_rec
  79: rustc_monomorphize::collector::collect_items_rec
  80: rustc_monomorphize::collector::collect_items_rec
  81: rustc_monomorphize::collector::collect_items_rec
  82: rustc_monomorphize::collector::collect_items_rec
  83: rustc_monomorphize::collector::collect_items_rec
  84: rustc_monomorphize::collector::collect_items_rec
  85: rustc_monomorphize::collector::collect_items_rec
  86: rustc_monomorphize::collector::collect_items_rec
  87: rustc_monomorphize::collector::collect_items_rec
  88: rustc_monomorphize::collector::collect_items_rec
  89: rustc_monomorphize::collector::collect_items_rec
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.79.0 (129f3b996 2024-06-10) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=1 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [try_normalize_generic_arg_after_erasing_regions] normalizing `<<&alloc::vec::Vec<alloc::string::String> as core::iter::traits::collect::IntoIterator>::IntoIter as core::iter::traits::iterator::Iterator>::try_for_each<{closure@<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde_json::value::ser::Serializer>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> as serde::ser::Serializer>::collect_seq<&alloc::vec::Vec<alloc::string::String>>::{closure#0}}, core::result::Result<(), <serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde::__private::ser::TaggedSerializer<serde_json::value::ser::Serializer>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> as serde::ser::Serializer>::Error>>`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
```