File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
compiler/rustc_next_trait_solver/src/solve Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -389,6 +389,19 @@ pub struct GoalEvaluation<I: Interner> {
389
389
/// The goal we've evaluated. This is the input goal, but potentially with its
390
390
/// inference variables resolved. This never applies any inference constraints
391
391
/// from evaluating the goal.
392
+ ///
393
+ /// We rely on this to check whether root goals in HIR typeck had an unresolved
394
+ /// type inference variable in the input. We must not resolve this after evaluating
395
+ /// the goal as even if the inference variable has been resolved by evaluating the
396
+ /// goal itself, this goal may still end up failing due to region uniquification
397
+ /// later on.
398
+ ///
399
+ /// This is used as a minor optimization to avoid re-resolving inference variables
400
+ /// when reevaluating ambiguous goals. E.g. if we've got a goal `?x: Trait` with `?x`
401
+ /// already being constrained to `Vec<?y>`, then the first evaluation resolves it to
402
+ /// `Vec<?y>: Trait`. If this goal is still ambiguous and we later resolve `?y` to `u32`,
403
+ /// then reevaluating this goal now only needs to resolve `?y` while it would otherwise
404
+ /// have to resolve both `?x` and `?y`,
392
405
pub goal : Goal < I , I :: Predicate > ,
393
406
pub certainty : Certainty ,
394
407
pub has_changed : HasChanged ,
You can’t perform that action at this time.
0 commit comments