This file contains a number of standalone functions useful for taking fast paths in the trait
solver. The exact place where we check for these fast paths changes, and matters a lot for
performance. Ideally we’d only check them in evaluate_goal, but when evaluating root goals
we can check them earlier and save some time creating an EvalCtxt in the first place.
A bit like NoSolution, but for functions that normally cannot fail unless they accessed
opaues. (See TypingMode::ErasedNotCoherence). Getting OpaquesAccessed doesn’t mean there
truly is no solution. It just means that we want to bail out of the current query as fast as
possible, possibly by returning NoSolution if that’s fastest. This is okay because when you get
OpaquesAccessed we’re guaranteed that we’re going to retry this query in the original typing
mode to get the correct answer.
Which trait candidates should be preferred over other candidates? By default, prefer where
bounds over alias bounds. For marker traits, prefer alias bounds over where bounds.
Supporting not-yet-defined opaque types in HIR typeck is somewhat
challenging. Ideally we’d normalize them to a new inference variable
and just defer type inference which relies on the opaque until we’ve
constrained the hidden type.
Whether the given region constraint should be considered/ignored for
leak check. In most part of the compiler, this should be Yes, except
for applying constraints from the nested goals in next-solver.
Unreachable is used in places in which leak check isn’t done, e.g.
borrowck.