rustc_next_trait_solver::solve

Module alias_relate

Source
Expand description

Implements the AliasRelate goal, which is used when unifying aliases. Doing this via a separate goal is called “deferred alias relation” and part of our more general approach to “lazy normalization”.

This is done by first structurally normalizing both sides of the goal, ending up in either a concrete type, rigid alias, or an infer variable. These are related further according to the rules below:

(1.) If we end up with two rigid aliases, then we relate them structurally.

(2.) If we end up with an infer var and a rigid alias, then we instantiate the infer var with the constructor of the alias and then recursively relate the terms.

(3.) Otherwise, if we end with two rigid (non-projection) or infer types, relate them structurally.