about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-11-14 23:25:41 +0000
committerMichael Goulet <michael@errs.io>2022-11-29 19:02:40 +0000
commit9512446a00dd203196dc0e716bd34d107299bc1d (patch)
treeeaa332e6ce2ce1e1aafac38f6da8f922299feb14
parente0098a5cc3a87d857e597af824d0ce1ed1ad85e0 (diff)
downloadrust-9512446a00dd203196dc0e716bd34d107299bc1d.tar.gz
rust-9512446a00dd203196dc0e716bd34d107299bc1d.zip
Explain why rematch_impl fails to be infallible
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index a2d2d44fbc2..a3c182d4bec 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -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!(