From 372e4aee1de04517bb6f4b187d00f076499d7b15 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Tue, 7 Aug 2018 21:33:27 +0100 Subject: [PATCH] Tweek best_blame_constraint to slightly prefer specific explanations --- .../nll/region_infer/error_reporting/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs index f7738f65e4041..422b5c2a39d35 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs @@ -124,13 +124,15 @@ impl<'tcx> RegionInferenceContext<'tcx> { let constraint = &self.constraints[path[i]]; let constraint_sup_scc = self.constraint_sccs.scc(constraint.sup); - if constraint_sup_scc == target_scc { - return false; - } match categorized_path[i].0 { ConstraintCategory::Boring => false, - _ => true, + ConstraintCategory::Other => { + // other isn't interesting when the two lifetimes + // are unified. + constraint_sup_scc != self.constraint_sccs.scc(constraint.sub) + } + _ => constraint_sup_scc != target_scc, } }); if let Some(i) = best_choice {