implied_bounds: deal with inference vars by lcnr · Pull Request #102016 · rust-lang/rust (original) (raw)

Just checked, it does fix it.

Now I'm wondering if I could find a minimal repro of a case that fails without my PR (and more-so with yours). I only really found the bug my PR aims to solve by making other changes (that didn't quite work anyways). I don't think yours solves that bug.

However, I have to think a little bit about why my PR does solve this test, since it seems to be because of not resolving the var before computing components. If I had to guess, the reason my PR fixes the issue, is because we properly register everything as implied, not constraints, even though it's an unresolved inference var. But then later we normalize and register everything properly.

I think the fully correct behavior is the intersection between these two PRs: we should be resolving variables before computing components for them and we shouldn't be registering implied bounds as constraints.

Two things I'd like to know about this (even though I'm not sure it's needed for this PR):

  1. If you were to make the change I was trying to make in Fix implied outlives bounds logic for projections #101680 - namely pushing constraints immediately after registering implied bounds - does the hyper benchmark from rustc-perf still fail to build (how I found the bug).
  2. With this PR, if we try to take implied bounds from normalized types (as in don't add implied bounds after normalization #99832), do we still run into that one test failure?

r? @jackh726