Repository: rust
Issue: ICE: Found unstable fingerprints for evaluate_obligation - computing whether enum is freeze - optimizing MIR
Labels: I-ICE,T-compiler,A-incr-comp,C-bug

<!--
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/
-->

This occurred twice 20 minutes ago, and I didn't notice at the time. I think it was triggered by r-a check on save. There weren't any errors in r-a logs I could see. I tried undoing changes to the file but couldn't find a state which would trigger the ICE again. I wasn't modifying any of the types referenced in the error so not sure what's going on there.

It's a closed source project so I can't include much more code, and I can't repro to minimize. Not much to go off of but maybe someone else will hit the same error and add more context.

### Code

```Rust
#![no_std]
#![no_main]
#![feature(
    panic_info_message,
    alloc_error_handler,
    const_float_bits_conv,
    slice_as_chunks,
    type_alias_impl_trait,
    impl_trait_in_assoc_type,
    try_blocks
)]

#[derive(defmt::Format)]
pub enum ReadWriteError {
    Sdmmc(#[defmt(Debug2Format)] crate::sdmmc::SdFilesystemError),
    Eeprom(embassy_stm32::i2c::Error),
    Serialize(postcard::Error),
    Timeout(crate::utils::TimeoutError),
    Crc,
    Erased,
    BufferSize,
}

#[derive(defmt::Format, Clone, Copy)]
pub struct TimeoutError(pub defmt::Str);

pub type SdFilesystemError = embedded_sdmmc::Error<sdmmc::Error>;
```


### 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 1.80.0-nightly (8387315ab 2024-05-14)
binary: rustc
commit-hash: 8387315ab3c26a57a1f53a90f188f0bc88514bca
commit-date: 2024-05-14
host: x86_64-pc-windows-msvc
release: 1.80.0-nightly
LLVM version: 18.1.4
```

### Error output

```
thread 'rustc' panicked at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca\compiler\rustc_query_system\src\query\plumbing.rs:726:9:
Found unstable fingerprints for evaluate_obligation(6f1c103ac826de07-e548c86591533bf0): Ok(EvaluatedToAmbig)
...
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `config::ReadWriteError: core::marker::Freeze`
#1 [is_freeze_raw] computing whether `config::ReadWriteError` is freeze
#2 [optimized_mir] optimizing MIR for `config::load::{closure#0}`
#3 [analysis] running analysis passes on this crate
end of query stack
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
thread 'rustc' panicked at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca\compiler\rustc_query_system\src\query\plumbing.rs:726:9:
Found unstable fingerprints for evaluate_obligation(6f1c103ac826de07-e548c86591533bf0): Ok(EvaluatedToAmbig)
stack backtrace:
   0:     0x7fffb85ad553 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7fffb85ad553 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7fffb85ad553 - std::backtrace::Backtrace::create
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\std\src\backtrace.rs:331
   3:     0x7fffb85ad49a - std::backtrace::Backtrace::force_capture
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\std\src\backtrace.rs:312
   4:     0x7fff62b31c30 - memchr
   5:     0x7fffb85c7197 - alloc::boxed::impl$50::call
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\alloc\src\boxed.rs:2036
   6:     0x7fffb85c7197 - std::panicking::rust_panic_with_hook
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\std\src\panicking.rs:799
   7:     0x7fffb85c7027 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\std\src\panicking.rs:664
   8:     0x7fffb85c453f - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\std\src\sys_common\backtrace.rs:171
   9:     0x7fffb85c6cd8 - std::panicking::begin_panic_handler
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\std\src\panicking.rs:652
  10:     0x7fffb861e9b4 - core::panicking::panic_fmt
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\core\src\panicking.rs:72
  11:     0x7fff634debed - <rustc_ty_utils[65a9b9de24cd032c]::opaque_types::OpaqueTypeCollector as rustc_type_ir[c0d275ccce6ad968]::visit::TypeVisitor<rustc_middle[185d9467bf8edcfd]::ty::context::TyCtxt>>::visit_ty
  12:     0x7fff62139be0 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  13:     0x7fff62101ff6 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  14:     0x7fff621ebfcb - rustc_query_impl[3f89ac50be2dec27]::plumbing::query_key_hash_verify_all
  15:     0x7fff624bb401 - rustc_trait_selection[1ded2741bfd27015]::traits::type_known_to_meet_bound_modulo_regions
  16:     0x7fff62061e7c - rustc_ty_utils[65a9b9de24cd032c]::common_traits::is_sized_raw
  17:     0x7fff6139800a - <dyn std[9bb6a677f5aa8dd6]::io::Write as nu_ansi_term[b76f2bc92cf0c282]::write::AnyWrite>::write_str
  18:     0x7fff620e7c41 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  19:     0x7fff613b1ecc - rustc_query_impl[3f89ac50be2dec27]::query_system
  20:     0x7fff62a5788b - <rustc_middle[185d9467bf8edcfd]::query::on_disk_cache::CacheEncoder as rustc_span[357887798d367320]::SpanEncoder>::encode_def_id
  21:     0x7fff629c1103 - <rustc_middle[185d9467bf8edcfd]::ty::Ty>::is_freeze
  22:     0x7fff61b4c38a - <rustc_mir_transform[836b0170f23a7b5e]::ssa::SsaLocals>::new
  23:     0x7fff61bae353 - <rustc_mir_transform[836b0170f23a7b5e]::ref_prop::ReferencePropagation as rustc_middle[185d9467bf8edcfd]::mir::MirPass>::run_pass
  24:     0x7fff61aded7c - <rustc_mir_transform[836b0170f23a7b5e]::simplify::SimplifyCfg as rustc_middle[185d9467bf8edcfd]::mir::MirPass>::run_pass
  25:     0x7fff61b784f9 - rustc_mir_transform[836b0170f23a7b5e]::optimized_mir
  26:     0x7fff621da1bf - rustc_query_impl[3f89ac50be2dec27]::plumbing::query_key_hash_verify_all
  27:     0x7fff620d52c8 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  28:     0x7fff61396a6d - <dyn std[9bb6a677f5aa8dd6]::io::Write as nu_ansi_term[b76f2bc92cf0c282]::write::AnyWrite>::write_str
  29:     0x7fff63554d8f - <rustc_ty_utils[65a9b9de24cd032c]::opaque_types::OpaqueTypeCollector as rustc_type_ir[c0d275ccce6ad968]::visit::TypeVisitor<rustc_middle[185d9467bf8edcfd]::ty::context::TyCtxt>>::visit_ty
  30:     0x7fff620a5d5f - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  31:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  32:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  33:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  34:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  35:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  36:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  37:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  38:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  39:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  40:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  41:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  42:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  43:     0x7fff620a5cd4 - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  44:     0x7fff620a5a0a - rustc_ty_utils[65a9b9de24cd032c]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  45:     0x7fff612b1afa - rustc_ty_utils[65a9b9de24cd032c]::ty::adt_sized_constraint
  46:     0x7fff613aa96b - rustc_query_impl[3f89ac50be2dec27]::query_system
  47:     0x7fff61a3ed6f - rustc_hir_analysis[9bdbbee3816bc531]::check_crate
  48:     0x7fff617af932 - <rustc_interface[eb292783735946cf]::passes::LintStoreExpandImpl as rustc_expand[e0a1eb7c60de3be9]::base::LintStoreExpand>::pre_expansion_lint
  49:     0x7fff5e9f8227 - rustc_interface[eb292783735946cf]::passes::create_global_ctxt
  50:     0x7fff6139aeda - <dyn std[9bb6a677f5aa8dd6]::io::Write as nu_ansi_term[b76f2bc92cf0c282]::write::AnyWrite>::write_str
  51:     0x7fff612bb679 - rustc_ty_utils[65a9b9de24cd032c]::ty::adt_sized_constraint
  52:     0x7fff613a0463 - rustc_query_impl[3f89ac50be2dec27]::query_system
  53:     0x7fff5e9b3b59 - llvm::function_ref<void __cdecl(llvm::Value const * __ptr64)>::callback_fn<`llvm::Value::stripInBoundsOffsets'::`1'::<lambda_1_1> >
  54:     0x7fff5e9b0dbf - llvm::function_ref<void __cdecl(llvm::Value const * __ptr64)>::callback_fn<`llvm::Value::stripInBoundsOffsets'::`1'::<lambda_1_1> >
  55:     0x7fff5e9b8be9 - llvm::function_ref<void __cdecl(llvm::Value const * __ptr64)>::callback_fn<`llvm::Value::stripInBoundsOffsets'::`1'::<lambda_1_1> >
  56:     0x7fffb85d823d - alloc::boxed::impl$48::call_once
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\alloc\src\boxed.rs:2022
  57:     0x7fffb85d823d - alloc::boxed::impl$48::call_once
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\alloc\src\boxed.rs:2022
  58:     0x7fffb85d823d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/8387315ab3c26a57a1f53a90f188f0bc88514bca/library\std\src\sys\pal\windows\thread.rs:52
  59:     0x7ff83f9e257d - BaseThreadInitThunk
  60:     0x7ff8411eaf28 - RtlUserThreadStart
```

</p>
</details>