Repository: rust
Issue: ICE: OutputTypeParameterMismatch
Labels: I-ICE,T-compiler,C-bug,E-needs-bisection,S-needs-repro

### Meta

We have a weekly CI job with a build matrix of Rust versions
- 1.65.0
- stable
- beta
- nightly

The last passing build was 2023-10-24. The following is a chronology.

---

2023-10-24
All rust versions PASS ✅ 

'1.65.0-x86_64-unknown-linux-gnu'
latest update on 2022-11-03, rust version 1.65.0 (897e37553 2022-11-02)

'stable-x86_64-unknown-linux-gnu'
latest update on 2023-10-05, rust version 1.73.0 (cc66ad468 2023-10-03)

'beta-x86_64-unknown-linux-gnu'
latest update on 2023-10-21, rust version 1.74.0-beta.4 (489647f98 2023-10-21)

'nightly-x86_64-unknown-linux-gnu'
latest update on 2023-10-24, rust version 1.75.0-nightly (cd674d617 2023-10-24)

---

2023-10-31

PASS for 1.65.0, stable, and beta ✅ 

'nightly-x86_64-unknown-linux-gnu'
(exact version already GC’ed from CI systems but, reproduced with 2023-10-30 nightly)
FAIL ❌ 

---

2023-11-07

PASS for 1.65.0 and stable ✅ 

'beta-x86_64-unknown-linux-gnu'
latest update on 2023-10-21, rust version 1.74.0-beta.4 (489647f98 2023-10-21)
PASS ✅ 

'nightly-x86_64-unknown-linux-gnu'
latest update on 2023-11-07, rust version 1.75.0-nightly (189d6c71f 2023-11-06)
FAIL ❌ 

---

2023-11-14

PASS for 1.65.0 and stable ✅ 

'nightly-x86_64-unknown-linux-gnu'
latest update on 2023-11-14, rust version 1.76.0-nightly (ba7c7a301 2023-11-13)
PASS ✅ 

'beta-x86_64-unknown-linux-gnu'
latest update on 2023-11-13, rust version 1.75.0-beta.1 (782883f60 2023-11-12)
FAIL ❌ 

---

Summary:
- 1.75.0-nightly did succeed on 2023-10-24
- 1.75.0-nightly was first observed to fail on 2023-10-31
- 1.76.0-nightly now succeeds (2023-11-14)
- 1.75.0-beta.1 was first observed to fail on 2023-11-14

### Error output

<details><summary><strong>Backtrace</strong></summary>
<p>

```
error: internal compiler error: compiler/rustc_traits/src/codegen.rs:43:13: Encountered error `
    OutputTypeParameterMismatch(
      SelectionOutputTypeParameterMismatch {
        found_trait_ref: Binder { value: <fn(<round_digest::RoundDigestTag<<Dps as mpc_signing::protocols::cggmp21::DpsProtocol>::SendAllReport2> as mpc_signing::utils::VerifyDeserialize>::VerifyError) -> ds::VerifyError<Dps, Ds> {ds::VerifyError::<Dps, Ds>::Round2} as std::ops::FnOnce<(<round_digest::RoundDigestTag<<Dps as mpc_signing::protocols::cggmp21::DpsProtocol>::SendAllReport2> as mpc_signing::utils::VerifyDeserialize>::VerifyError,)>>, bound_vars: [] },
        expected_trait_ref: Binder { value: <fn(<round_digest::RoundDigestTag<<Dps as mpc_signing::protocols::cggmp21::DpsProtocol>::SendAllReport2> as mpc_signing::utils::VerifyDeserialize>::VerifyError) -> ds::VerifyError<Dps, Ds> {ds::VerifyError::<Dps, Ds>::Round2} as std::ops::FnOnce<(round_digest::VerifyError<<<Dps as mpc_signing::protocols::cggmp21::DpsProtocol>::SendAllReport2 as mpc_signing::utils::VerifyDeserialize>::VerifyError>,)>>, bound_vars: [] },
        terr: Sorts(ExpectedFound {
          expected: round_digest::VerifyError<Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Dps/#0], def_id: DefId(22:4767 ~ mpc_signing[4ddb]::protocols::cggmp21::dps_protocol::traits::DpsProtocol::SendAllReport2) })], def_id: DefId(22:3108 ~ mpc_signing[4ddb]::utils::zkp_stream::VerifyDeserialize::VerifyError) })>,
          found: Alias(Projection, AliasTy { args: [round_digest::RoundDigestTag<Alias(Projection, AliasTy { args: [Dps/#0], def_id: DefId(22:4767 ~ mpc_signing[4ddb]::protocols::cggmp21::dps_protocol::traits::DpsProtocol::SendAllReport2) })>], def_id: DefId(22:3108 ~ mpc_signing[4ddb]::utils::zkp_stream::VerifyDeserialize::VerifyError) }) }) }
    )` selecting `
      <fn(<round_digest::RoundDigestTag<<Dps as mpc_signing::protocols::cggmp21::DpsProtocol>::SendAllReport2> as mpc_signing::utils::VerifyDeserialize>::VerifyError)
        -> ds::VerifyError<Dps, Ds> {ds::VerifyError::<Dps, Ds>::Round2} as std::ops::FnOnce<(round_digest::VerifyError<<<Dps as mpc_signing::protocols::cggmp21::DpsProtocol>::SendAllReport2 as mpc_signing::utils::VerifyDeserialize>::VerifyError>,)>>
  ` during codegen
```

</p>
</details>


Capture of **_Nightly_** failure (2023-10-31) ❌ 
[rustc-ice-2023-10-31T16_49_05-19815.txt](https://github.com/rust-lang/rust/files/13369546/rustc-ice-2023-10-31T16_49_05-19815.txt)

Capture of **_Beta_** failure (2023-11-15) ❌ 
[rustc-ice-2023-11-15.txt](https://github.com/rust-lang/rust/files/13369550/rustc-ice-2023-11-15.txt)


### Code

From 2023-10-24 to today the source code has _not_ changed. The code is not public, but could potentially be shared. Unfortunately, the code is complex due to the use of a declarative macro, so we do not currently have a minimization.

We would welcome some hints/suggestions about what code/context we could capture to improve this issue.