Skip to content

Commit d88699f

Browse files
authored
Rollup merge of #104427 - compiler-errors:rematch-impl-may-fail-actually, r=lcnr
Explain why `rematch_impl` fails to be infallible Fixes #104395 r? `@lcnr`
2 parents 3617adf + 9512446 commit d88699f

File tree

1 file changed

+7
-0
lines changed
  • compiler/rustc_trait_selection/src/traits/select

1 file changed

+7
-0
lines changed

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
21402140
match self.match_impl(impl_def_id, impl_trait_ref, obligation) {
21412141
Ok(substs) => substs,
21422142
Err(()) => {
2143+
// FIXME: A rematch may fail when a candidate cache hit occurs
2144+
// on thefreshened form of the trait predicate, but the match
2145+
// fails for some reason that is not captured in the freshened
2146+
// cache key. For example, equating an impl trait ref against
2147+
// the placeholder trait ref may fail due the Generalizer relation
2148+
// raising a CyclicalTy error due to a sub_root_var relation
2149+
// for a variable being generalized...
21432150
self.infcx.tcx.sess.delay_span_bug(
21442151
obligation.cause.span,
21452152
&format!(

0 commit comments

Comments
 (0)