Skip to content

Commit

Permalink
Rollup merge of #104427 - compiler-errors:rematch-impl-may-fail-actua…
Browse files Browse the repository at this point in the history
…lly, r=lcnr

Explain why `rematch_impl` fails to be infallible

Fixes #104395

r? `@lcnr`
  • Loading branch information
matthiaskrgr authored Nov 29, 2022
2 parents 3617adf + 9512446 commit d88699f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
match self.match_impl(impl_def_id, impl_trait_ref, obligation) {
Ok(substs) => substs,
Err(()) => {
// FIXME: A rematch may fail when a candidate cache hit occurs
// on thefreshened form of the trait predicate, but the match
// fails for some reason that is not captured in the freshened
// cache key. For example, equating an impl trait ref against
// the placeholder trait ref may fail due the Generalizer relation
// raising a CyclicalTy error due to a sub_root_var relation
// for a variable being generalized...
self.infcx.tcx.sess.delay_span_bug(
obligation.cause.span,
&format!(
Expand Down

0 comments on commit d88699f

Please sign in to comment.