about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2018-08-07 21:33:27 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2018-08-14 20:35:46 +0100
commit372e4aee1de04517bb6f4b187d00f076499d7b15 (patch)
tree6fa42f984b116356c7db59833e171a4eac4512cf /src
parent7710d959f46579a04934fb6a50793e380544f24b (diff)
downloadrust-372e4aee1de04517bb6f4b187d00f076499d7b15.tar.gz
rust-372e4aee1de04517bb6f4b187d00f076499d7b15.zip
Tweek best_blame_constraint to slightly prefer specific explanations
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs10
1 files 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 f7738f65e40..422b5c2a39d 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 {